aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Steiner <ssteiner@apache.org>2024-06-21 11:35:59 +0100
committerSimon Steiner <ssteiner@apache.org>2024-06-21 11:35:59 +0100
commitca1d532dc3f4c9e4bfecbcb64caf63afa38a76a9 (patch)
treefa64c50baaa32bca95a01fa77c5e22e83451ccd3
parent12e2889f4e86bd99cb2bc5e5a183e275e22c91de (diff)
downloadxmlgraphics-fop-ca1d532dc3f4c9e4bfecbcb64caf63afa38a76a9.tar.gz
xmlgraphics-fop-ca1d532dc3f4c9e4bfecbcb64caf63afa38a76a9.zip
Test was using deprecated junit API
-rw-r--r--fop-core/src/test/java/org/apache/fop/cli/CommandLineOptions2TestCase.java24
1 files changed, 10 insertions, 14 deletions
diff --git a/fop-core/src/test/java/org/apache/fop/cli/CommandLineOptions2TestCase.java b/fop-core/src/test/java/org/apache/fop/cli/CommandLineOptions2TestCase.java
index 518069154..778544dd0 100644
--- a/fop-core/src/test/java/org/apache/fop/cli/CommandLineOptions2TestCase.java
+++ b/fop-core/src/test/java/org/apache/fop/cli/CommandLineOptions2TestCase.java
@@ -18,12 +18,12 @@
package org.apache.fop.cli;
import java.io.File;
-import java.io.IOException;
-import org.junit.Rule;
+import org.junit.Assert;
import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.function.ThrowingRunnable;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
@@ -32,32 +32,28 @@ import org.apache.fop.apps.FOPException;
public class CommandLineOptions2TestCase {
- @Rule
- public ExpectedException exceptionRule = ExpectedException.none();
-
/**
* Check that the parser detects the case where the -xsl switch has been omitted.
* This detection prevents the XSL file being deleted.
- * @throws FOPException
- * @throws IOException
*/
@Test
- public void testXslSwitchMissing() throws FOPException, IOException {
+ public void testXslSwitchMissing() {
final String xslFilename = "../fop/examples/embedding/xml/xslt/projectteam2fo.xsl";
final String outputFilename = "out.pdf";
- exceptionRule.expect(FOPException.class);
- exceptionRule.expectMessage("Don't know what to do with " + outputFilename);
// -xsl switch omitted.
String cmdLine = "-xml ../fop/examples/embedding/xml/xml/projectteam.xml " + xslFilename + " " + outputFilename;
String[] args = cmdLine.split(" ");
CommandLineOptions clo = new CommandLineOptions();
- clo.parse(args);
+ Exception exception = Assert.assertThrows(FOPException.class, new ThrowingRunnable() {
+ public void run() throws Throwable {
+ clo.parse(args);
+ }
+ });
+ assertEquals(exception.getMessage(), "Don't know what to do with " + outputFilename);
}
/**
* Check that the XSL file is not deleted in the case where the -xsl switch has been omitted.
- * @throws FOPException
- * @throws IOException
*/
@Test
public void testXslFileNotDeleted() {