aboutsummaryrefslogtreecommitdiffstats
path: root/test/java/org/apache/fop/config
diff options
context:
space:
mode:
authorVincent Hennebert <vhennebert@apache.org>2011-10-04 10:09:01 +0000
committerVincent Hennebert <vhennebert@apache.org>2011-10-04 10:09:01 +0000
commit91c66d97428aa57c844ec58e1deb07a8ab745574 (patch)
treed6062f718053ad636c8f587d5d5f199e9d158252 /test/java/org/apache/fop/config
parent7d33c81a0a079336dd1ffcac97e4ee1dfba16c36 (diff)
downloadxmlgraphics-fop-91c66d97428aa57c844ec58e1deb07a8ab745574.tar.gz
xmlgraphics-fop-91c66d97428aa57c844ec58e1deb07a8ab745574.zip
Bugzilla #51928: Upgraded all tests to JUnit 4
Patch by Mehdi Houshmand, applied with minor cosmetics and error fixes git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1178747 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/java/org/apache/fop/config')
-rw-r--r--test/java/org/apache/fop/config/BaseConstructiveUserConfigTestCase.java15
-rw-r--r--test/java/org/apache/fop/config/BaseDestructiveUserConfigTestCase.java15
-rw-r--r--test/java/org/apache/fop/config/BaseUserConfigTestCase.java15
-rw-r--r--test/java/org/apache/fop/config/FOURIResolverTestCase.java8
-rw-r--r--test/java/org/apache/fop/config/FontAttributesMissingTestCase.java10
-rw-r--r--test/java/org/apache/fop/config/FontBaseBadTestCase.java8
-rw-r--r--test/java/org/apache/fop/config/FontEmbedUrlBadTestCase.java8
-rw-r--r--test/java/org/apache/fop/config/FontEmbedUrlMalformedTestCase.java8
-rw-r--r--test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java13
-rw-r--r--test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java10
-rw-r--r--test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java10
-rw-r--r--test/java/org/apache/fop/config/FontsAutoDetectTestCase.java8
-rw-r--r--test/java/org/apache/fop/config/FontsDirectoryBadTestCase.java12
-rw-r--r--test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java8
-rw-r--r--test/java/org/apache/fop/config/FontsSubstitutionTestCase.java16
-rw-r--r--test/java/org/apache/fop/config/UserConfigTestSuite.java43
16 files changed, 61 insertions, 146 deletions
diff --git a/test/java/org/apache/fop/config/BaseConstructiveUserConfigTestCase.java b/test/java/org/apache/fop/config/BaseConstructiveUserConfigTestCase.java
index b94c47373..3583729e9 100644
--- a/test/java/org/apache/fop/config/BaseConstructiveUserConfigTestCase.java
+++ b/test/java/org/apache/fop/config/BaseConstructiveUserConfigTestCase.java
@@ -19,19 +19,20 @@
package org.apache.fop.config;
-public abstract class BaseConstructiveUserConfigTestCase extends BaseUserConfigTestCase {
+import static org.junit.Assert.fail;
- /**
- * @see junit.framework.TestCase#TestCase(String)
- */
- public BaseConstructiveUserConfigTestCase(String name) {
- super(name);
- }
+import org.junit.Test;
+
+/**
+ * Super class of several user config cases.
+ */
+public abstract class BaseConstructiveUserConfigTestCase extends BaseUserConfigTestCase {
/**
* Test using a standard FOP font
* @throws Exception checkstyle wants a comment here, even a silly one
*/
+ @Test
public void testUserConfig() throws Exception {
try {
initConfig();
diff --git a/test/java/org/apache/fop/config/BaseDestructiveUserConfigTestCase.java b/test/java/org/apache/fop/config/BaseDestructiveUserConfigTestCase.java
index 0d294d328..2ea259e78 100644
--- a/test/java/org/apache/fop/config/BaseDestructiveUserConfigTestCase.java
+++ b/test/java/org/apache/fop/config/BaseDestructiveUserConfigTestCase.java
@@ -19,18 +19,21 @@
package org.apache.fop.config;
+import static org.junit.Assert.fail;
+
import org.apache.fop.apps.FOPException;
+import org.junit.Test;
+/**
+ * Super class for several user configuration failure cases.
+ */
public abstract class BaseDestructiveUserConfigTestCase extends BaseUserConfigTestCase {
/**
- * @see junit.framework.TestCase#TestCase(String)
+ * Test the user configuration failure.
*/
- public BaseDestructiveUserConfigTestCase(String name) {
- super(name);
- }
-
- public void testUserConfig() throws Exception {
+ @Test
+ public void testUserConfig() {
try {
initConfig();
convertFO();
diff --git a/test/java/org/apache/fop/config/BaseUserConfigTestCase.java b/test/java/org/apache/fop/config/BaseUserConfigTestCase.java
index 6ce833312..ad884782d 100644
--- a/test/java/org/apache/fop/config/BaseUserConfigTestCase.java
+++ b/test/java/org/apache/fop/config/BaseUserConfigTestCase.java
@@ -23,16 +23,14 @@ import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
-import org.xml.sax.SAXException;
-
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.render.pdf.BasePDFTestCase;
+import org.xml.sax.SAXException;
/**
* Basic runtime test for FOP's font configuration. It is used to verify that
@@ -47,13 +45,6 @@ public abstract class BaseUserConfigTestCase extends BasePDFTestCase {
/**
- * @see junit.framework.TestCase#TestCase(String)
- */
- public BaseUserConfigTestCase(String name) {
- super(name);
- }
-
- /**
* @see org.apache.fop.render.pdf.BasePDFTestCase#init()
*/
protected void init() {
@@ -102,8 +93,8 @@ public abstract class BaseUserConfigTestCase extends BasePDFTestCase {
*/
protected abstract String getUserConfigFilename();
- /*
- * @see junit.framework.TestCase#getName()
+ /**
+ * The name of this test.
*/
public String getName() {
return getUserConfigFilename();
diff --git a/test/java/org/apache/fop/config/FOURIResolverTestCase.java b/test/java/org/apache/fop/config/FOURIResolverTestCase.java
index e0f6d7f81..1ffe8b065 100644
--- a/test/java/org/apache/fop/config/FOURIResolverTestCase.java
+++ b/test/java/org/apache/fop/config/FOURIResolverTestCase.java
@@ -19,21 +19,23 @@
package org.apache.fop.config;
-import java.net.MalformedURLException;
+import static org.junit.Assert.fail;
-import junit.framework.TestCase;
+import java.net.MalformedURLException;
import org.apache.fop.apps.FOURIResolver;
+import org.junit.Test;
/**
* This tests some aspects of the {@link FOURIResolver} class.
*/
-public class FOURIResolverTestCase extends TestCase {
+public class FOURIResolverTestCase {
/**
* Checks the {@link FOURIResolver#checkBaseURL(String)} method.
* @throws Exception if an error occurs
*/
+ @Test
public void testCheckBaseURI() throws Exception {
FOURIResolver resolver = new FOURIResolver(true);
System.out.println(resolver.checkBaseURL("./test/config"));
diff --git a/test/java/org/apache/fop/config/FontAttributesMissingTestCase.java b/test/java/org/apache/fop/config/FontAttributesMissingTestCase.java
index 00e9b181b..fe14a9928 100644
--- a/test/java/org/apache/fop/config/FontAttributesMissingTestCase.java
+++ b/test/java/org/apache/fop/config/FontAttributesMissingTestCase.java
@@ -19,18 +19,12 @@
package org.apache.fop.config;
-/*
+/**
* this font is without a metrics-url or an embed-url
*/
public class FontAttributesMissingTestCase extends BaseDestructiveUserConfigTestCase {
- public FontAttributesMissingTestCase(String name) {
- super(name);
- }
-
- /**
- * @see org.apache.fop.config.BaseUserConfigTestCase#getUserConfigFilename()
- */
+ @Override
public String getUserConfigFilename() {
return "test_font_attributes_missing.xconf";
}
diff --git a/test/java/org/apache/fop/config/FontBaseBadTestCase.java b/test/java/org/apache/fop/config/FontBaseBadTestCase.java
index 792acf59a..bffda3055 100644
--- a/test/java/org/apache/fop/config/FontBaseBadTestCase.java
+++ b/test/java/org/apache/fop/config/FontBaseBadTestCase.java
@@ -19,16 +19,12 @@
package org.apache.fop.config;
-/*
+/**
* This font base does not exist and a relative font path is used.
*/
public class FontBaseBadTestCase extends BaseDestructiveUserConfigTestCase {
- public FontBaseBadTestCase(String name) {
- super(name);
- }
-
- /** {@inheritDoc} */
+ @Override
public String getUserConfigFilename() {
return "test_fontbase_bad.xconf";
}
diff --git a/test/java/org/apache/fop/config/FontEmbedUrlBadTestCase.java b/test/java/org/apache/fop/config/FontEmbedUrlBadTestCase.java
index aa8b9e000..1640024fb 100644
--- a/test/java/org/apache/fop/config/FontEmbedUrlBadTestCase.java
+++ b/test/java/org/apache/fop/config/FontEmbedUrlBadTestCase.java
@@ -24,13 +24,7 @@ package org.apache.fop.config;
*/
public class FontEmbedUrlBadTestCase extends BaseDestructiveUserConfigTestCase {
- public FontEmbedUrlBadTestCase(String name) {
- super(name);
- }
-
- /**
- * @see org.apache.fop.config.BaseUserConfigTestCase#getUserConfigFilename()
- */
+ @Override
public String getUserConfigFilename() {
return "test_font_embedurl_bad.xconf";
}
diff --git a/test/java/org/apache/fop/config/FontEmbedUrlMalformedTestCase.java b/test/java/org/apache/fop/config/FontEmbedUrlMalformedTestCase.java
index 6d41b0a13..b45df16bc 100644
--- a/test/java/org/apache/fop/config/FontEmbedUrlMalformedTestCase.java
+++ b/test/java/org/apache/fop/config/FontEmbedUrlMalformedTestCase.java
@@ -24,13 +24,7 @@ package org.apache.fop.config;
*/
public class FontEmbedUrlMalformedTestCase extends BaseDestructiveUserConfigTestCase {
- public FontEmbedUrlMalformedTestCase(String name) {
- super(name);
- }
-
- /**
- * @see org.apache.fop.config.BaseUserConfigTestCase#getUserConfigFilename()
- */
+ @Override
public String getUserConfigFilename() {
return "test_font_embedurl_malformed.xconf";
}
diff --git a/test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java b/test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java
index 166274452..c22cd3eb2 100644
--- a/test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java
+++ b/test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java
@@ -19,21 +19,12 @@
package org.apache.fop.config;
-/*
+/**
* this font has a metrics-url that does not exist on filesystem
*/
public class FontMetricsUrlBadTestCase extends BaseDestructiveUserConfigTestCase {
- /**
- * @see junit.framework.TestCase#TestCase(String)
- */
- public FontMetricsUrlBadTestCase(String name) {
- super(name);
- }
-
- /**
- * @see org.apache.fop.config.BaseUserConfigTestCase#getUserConfigFilename()
- */
+ @Override
public String getUserConfigFilename() {
return "test_font_metricsurl_bad.xconf";
}
diff --git a/test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java b/test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java
index ae4dde886..27853adf9 100644
--- a/test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java
+++ b/test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java
@@ -19,18 +19,12 @@
package org.apache.fop.config;
-/*
+/**
* this font has a malformed metrics-url
*/
public class FontMetricsUrlMalformedTestCase extends BaseDestructiveUserConfigTestCase {
- public FontMetricsUrlMalformedTestCase(String name) {
- super(name);
- }
-
- /**
- * @see org.apache.fop.config.BaseUserConfigTestCase#getUserConfigFilename()
- */
+ @Override
public String getUserConfigFilename() {
return "test_font_metricsurl_malformed.xconf";
}
diff --git a/test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java b/test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java
index dcc0098be..186dd85df 100644
--- a/test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java
+++ b/test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java
@@ -19,18 +19,12 @@
package org.apache.fop.config;
-/*
+/**
* this font has a missing font triplet attribute
*/
public class FontTripletAttributeMissingTestCase extends BaseDestructiveUserConfigTestCase {
- public FontTripletAttributeMissingTestCase(String name) {
- super(name);
- }
-
- /**
- * @see org.apache.fop.config.BaseUserConfigTestCase#getUserConfigFilename()
- */
+ @Override
public String getUserConfigFilename() {
return "test_font_tripletattribute_missing.xconf";
}
diff --git a/test/java/org/apache/fop/config/FontsAutoDetectTestCase.java b/test/java/org/apache/fop/config/FontsAutoDetectTestCase.java
index 403bf3282..c435a08cf 100644
--- a/test/java/org/apache/fop/config/FontsAutoDetectTestCase.java
+++ b/test/java/org/apache/fop/config/FontsAutoDetectTestCase.java
@@ -21,13 +21,7 @@ package org.apache.fop.config;
public class FontsAutoDetectTestCase extends BaseConstructiveUserConfigTestCase {
- public FontsAutoDetectTestCase(String name) {
- super(name);
- }
-
- /**
- * @see org.apache.fop.config.BaseUserConfigTestCase#getUserConfigFilename()
- */
+ @Override
public String getUserConfigFilename() {
return "test_fonts_autodetect.xconf";
}
diff --git a/test/java/org/apache/fop/config/FontsDirectoryBadTestCase.java b/test/java/org/apache/fop/config/FontsDirectoryBadTestCase.java
index e83e5ca04..c19c161a3 100644
--- a/test/java/org/apache/fop/config/FontsDirectoryBadTestCase.java
+++ b/test/java/org/apache/fop/config/FontsDirectoryBadTestCase.java
@@ -19,23 +19,17 @@
package org.apache.fop.config;
-/*
+/**
* this font has a metrics-url that does not exist on filesystem
*/
public class FontsDirectoryBadTestCase extends BaseDestructiveUserConfigTestCase {
- public FontsDirectoryBadTestCase(String name) {
- super(name);
- }
-
- /**
- * @see org.apache.fop.config.BaseUserConfigTestCase#getUserConfigFilename()
- */
+ @Override
public String getUserConfigFilename() {
return "test_fonts_directory_bad.xconf";
}
- /** get test FOP config File */
+ @Override
protected String getFontFOFilePath() {
return "test/xml/bugtests/font-dir.fo";
}
diff --git a/test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java b/test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java
index 3c0205d3d..7eec1cab6 100644
--- a/test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java
+++ b/test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java
@@ -24,13 +24,7 @@ package org.apache.fop.config;
*/
public class FontsDirectoryRecursiveTestCase extends BaseConstructiveUserConfigTestCase {
- public FontsDirectoryRecursiveTestCase(String name) {
- super(name);
- }
-
- /**
- * @see org.apache.fop.config.BaseUserConfigTestCase#getUserConfigFilename()
- */
+ @Override
protected String getUserConfigFilename() {
return "test_fonts_directory_recursive.xconf";
}
diff --git a/test/java/org/apache/fop/config/FontsSubstitutionTestCase.java b/test/java/org/apache/fop/config/FontsSubstitutionTestCase.java
index 725f0d4d7..7ae576e9b 100644
--- a/test/java/org/apache/fop/config/FontsSubstitutionTestCase.java
+++ b/test/java/org/apache/fop/config/FontsSubstitutionTestCase.java
@@ -38,17 +38,7 @@ import org.apache.fop.render.PrintRenderer;
public class FontsSubstitutionTestCase extends
BaseConstructiveUserConfigTestCase {
- /**
- * Main constructor
- * @param name test case name
- */
- public FontsSubstitutionTestCase(String name) {
- super(name);
- }
-
- /**
- * {@inheritDoc}
- */
+ @Override
protected byte[] convertFO(File foFile, FOUserAgent ua, boolean dumpPdfFile)
throws Exception {
PrintRenderer renderer = (PrintRenderer) ua.getRendererFactory()
@@ -72,9 +62,7 @@ public class FontsSubstitutionTestCase extends
return null;
}
- /**
- * {@inheritDoc}
- */
+ @Override
public String getUserConfigFilename() {
return "test_fonts_substitution.xconf";
}
diff --git a/test/java/org/apache/fop/config/UserConfigTestSuite.java b/test/java/org/apache/fop/config/UserConfigTestSuite.java
index 168d87d51..d90efe37b 100644
--- a/test/java/org/apache/fop/config/UserConfigTestSuite.java
+++ b/test/java/org/apache/fop/config/UserConfigTestSuite.java
@@ -19,35 +19,26 @@
package org.apache.fop.config;
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
/**
* Test suite for font configuration.
*/
+@RunWith(Suite.class)
+@SuiteClasses({
+ FontBaseBadTestCase.class,
+ FontAttributesMissingTestCase.class,
+ FontTripletAttributeMissingTestCase.class,
+ FontMetricsUrlBadTestCase.class,
+ FontEmbedUrlBadTestCase.class,
+ FontMetricsUrlMalformedTestCase.class,
+ FontMetricsUrlMalformedTestCase.class,
+ FontsDirectoryRecursiveTestCase.class,
+ FontsAutoDetectTestCase.class,
+ FontsSubstitutionTestCase.class,
+ FOURIResolverTestCase.class
+})
public class UserConfigTestSuite {
-
- /**
- * Builds the test suite
- * @return the test suite
- */
- public static Test suite() {
- TestSuite suite = new TestSuite(
- "Basic functionality test suite for user configuration");
- //$JUnit-BEGIN$
- suite.addTest(new TestSuite(FontBaseBadTestCase.class));
- suite.addTest(new TestSuite(FontAttributesMissingTestCase.class));
- suite.addTest(new TestSuite(FontTripletAttributeMissingTestCase.class));
- suite.addTest(new TestSuite(FontMetricsUrlBadTestCase.class));
- suite.addTest(new TestSuite(FontEmbedUrlBadTestCase.class));
- suite.addTest(new TestSuite(FontMetricsUrlMalformedTestCase.class));
- suite.addTest(new TestSuite(FontEmbedUrlMalformedTestCase.class));
- suite.addTest(new TestSuite(FontsDirectoryRecursiveTestCase.class));
- suite.addTest(new TestSuite(FontsAutoDetectTestCase.class));
- suite.addTest(new TestSuite(FontsSubstitutionTestCase.class));
- suite.addTest(new TestSuite(FOURIResolverTestCase.class));
- //$JUnit-END$
- return suite;
- }
-
}