You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by vh...@apache.org on 2011/10/04 12:09:07 UTC

svn commit: r1178747 [2/3] - in /xmlgraphics/fop/trunk: ./ test/java/org/apache/fop/ test/java/org/apache/fop/afp/ test/java/org/apache/fop/afp/fonts/ test/java/org/apache/fop/afp/modca/ test/java/org/apache/fop/afp/parser/ test/java/org/apache/fop/are...

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/fo/flow/table/RowGroupBuilderTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/fo/flow/table/RowGroupBuilderTestCase.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/fo/flow/table/RowGroupBuilderTestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/fo/flow/table/RowGroupBuilderTestCase.java Tue Oct  4 10:09:01 2011
@@ -19,9 +19,16 @@
 
 package org.apache.fop.fo.flow.table;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
 import java.util.Iterator;
 import java.util.List;
 
+import org.junit.Test;
+
 /**
  * Tests that RowGroupBuilder returns, for each part of a table, the expected number of
  * row-groups with the expected number or rows in each.
@@ -137,34 +144,42 @@ public class RowGroupBuilderTestCase ext
         checkNextTableRowGroups(tableIter, new int[] {2}, new int[] {1, 3}, new int[][] {{2, 1, 3}});
     }
 
+    @Test
     public void testWithRowsSimple() throws Exception {
         checkSimple("table/RowGroupBuilder_simple.fo");
     }
 
+    @Test
     public void testWithRowsSpans() throws Exception {
         checkSpans("table/RowGroupBuilder_spans.fo");
     }
 
+    @Test
     public void testNoRowSimple() throws Exception {
         checkSimple("table/RowGroupBuilder_no-row_simple.fo");
     }
 
+    @Test
     public void testNoRowSpans() throws Exception {
         checkSpans("table/RowGroupBuilder_no-row_spans.fo");
     }
 
+    @Test
     public void testNoColWithRowsSimple() throws Exception {
         checkSimple("table/RowGroupBuilder_no-col_simple.fo");
     }
 
+    @Test
     public void testNoColWithRowsSpans() throws Exception {
         checkSpans("table/RowGroupBuilder_no-col_spans.fo");
     }
 
+    @Test
     public void testNoColNoRowSimple() throws Exception {
         checkSimple("table/RowGroupBuilder_no-col_no-row_simple.fo");
     }
 
+    @Test
     public void testNoColNoRowSpans() throws Exception {
         checkSpans("table/RowGroupBuilder_no-col_no-row_spans.fo");
     }

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/fo/flow/table/TableColumnColumnNumberTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/fo/flow/table/TableColumnColumnNumberTestCase.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/fo/flow/table/TableColumnColumnNumberTestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/fo/flow/table/TableColumnColumnNumberTestCase.java Tue Oct  4 10:09:01 2011
@@ -19,10 +19,13 @@
 
 package org.apache.fop.fo.flow.table;
 
+import static org.junit.Assert.assertEquals;
+
 import java.util.Iterator;
 
 import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.fo.FObj;
+import org.junit.Test;
 
 
 public class TableColumnColumnNumberTestCase extends AbstractTableTestCase {
@@ -61,6 +64,7 @@ public class TableColumnColumnNumberTest
         assertEquals(width, c.getColumnWidth().getValue(percentBaseContext));
     }
 
+    @Test
     public void testColumnNumber() throws Exception {
         setUp("table/table-column_column-number.fo");
         Iterator tableIter = getTableIterator();
@@ -97,6 +101,7 @@ public class TableColumnColumnNumberTest
         }
     }
 
+    @Test
     public void testImplicitColumns() throws Exception {
         setUp("table/implicit_columns_column-number.fo");
         percentBaseContext.setUnitaryWidth(100000);

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/fo/flow/table/TooManyColumnsTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/fo/flow/table/TooManyColumnsTestCase.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/fo/flow/table/TooManyColumnsTestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/fo/flow/table/TooManyColumnsTestCase.java Tue Oct  4 10:09:01 2011
@@ -19,6 +19,7 @@
 
 package org.apache.fop.fo.flow.table;
 
+import org.junit.Test;
 
 public class TooManyColumnsTestCase extends ErrorCheckTestCase {
 
@@ -26,26 +27,32 @@ public class TooManyColumnsTestCase exte
         super();
     }
 
+    @Test
     public void testBody1() throws Exception {
         launchTest("table/too-many-columns_body_1.fo");
     }
 
+    @Test
     public void testBody2() throws Exception {
         launchTest("table/too-many-columns_body_2.fo");
     }
 
+    @Test
     public void testBody3() throws Exception {
         launchTest("table/too-many-columns_body_3.fo");
     }
 
+    @Test
     public void testBody4() throws Exception {
         launchTest("table/too-many-columns_body_4.fo");
     }
 
+    @Test
     public void testHeader() throws Exception {
         launchTest("table/too-many-columns_header.fo");
     }
 
+    @Test
     public void testFooter() throws Exception {
         launchTest("table/too-many-columns_footer.fo");
     }

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/DejaVuLGCSerifTest.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/DejaVuLGCSerifTest.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/DejaVuLGCSerifTest.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/DejaVuLGCSerifTest.java Tue Oct  4 10:09:01 2011
@@ -19,14 +19,17 @@
 
 package org.apache.fop.fonts;
 
+import static org.junit.Assert.assertEquals;
+
 import java.io.File;
 
-import junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  *
  */
-public class DejaVuLGCSerifTest extends TestCase {
+public class DejaVuLGCSerifTest {
 
     private FontResolver fontResolver = FontManager.createMinimalFontResolver();
     private CustomFont font;
@@ -37,6 +40,7 @@ public class DejaVuLGCSerifTest extends 
      * @throws Exception
      *             if the test fails.
      */
+    @Before
     public void setUp() throws Exception {
         File file = new File("test/resources/fonts/DejaVuLGCSerif.ttf");
         font = FontLoader.loadFont(file, "", true, EncodingMode.AUTO,
@@ -46,6 +50,7 @@ public class DejaVuLGCSerifTest extends 
     /**
      * Simple test to see if font name was detected correctly.
      */
+    @Test
     public void testFontName() {
         assertEquals("DejaVuLGCSerif", font.getFontName());
     }

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/EncodingModeTest.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/EncodingModeTest.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/EncodingModeTest.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/EncodingModeTest.java Tue Oct  4 10:09:01 2011
@@ -19,15 +19,20 @@
 
 package org.apache.fop.fonts;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
 
-public class EncodingModeTest extends TestCase {
+import org.junit.Test;
+
+public class EncodingModeTest {
+
+    @Test
     public void testGetName() {
         assertEquals("auto", EncodingMode.AUTO.getName());
         assertEquals("single-byte", EncodingMode.SINGLE_BYTE.getName());
         assertEquals("cid", EncodingMode.CID.getName());
     }
 
+    @Test
     public void testGetValue() {
         assertEquals(EncodingMode.AUTO, EncodingMode.getEncodingMode("auto"));
         assertEquals(EncodingMode.SINGLE_BYTE, EncodingMode.getEncodingMode("single-byte"));

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/truetype/GlyfTableTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/truetype/GlyfTableTestCase.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/truetype/GlyfTableTestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/fonts/truetype/GlyfTableTestCase.java Tue Oct  4 10:09:01 2011
@@ -19,6 +19,8 @@
 
 package org.apache.fop.fonts.truetype;
 
+import static org.junit.Assert.assertTrue;
+
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -26,12 +28,13 @@ import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 
-import junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Tests {@link GlyfTable}.
  */
-public class GlyfTableTestCase extends TestCase {
+public class GlyfTableTestCase {
 
     private final static class DirData {
 
@@ -50,7 +53,7 @@ public class GlyfTableTestCase extends T
 
     private FontFileReader originalFontReader;
 
-    @Override
+    @Before
     public void setUp() throws IOException {
         originalFontReader = new FontFileReader("test/resources/fonts/DejaVuLGCSerif.ttf");
     }
@@ -60,6 +63,7 @@ public class GlyfTableTestCase extends T
      *
      * @throws IOException if an I/O error occurs
      */
+    @Test
     public void testPopulateGlyphsWithComposites() throws IOException {
         // Glyph 408 -> U+01D8 "uni01D8" this is a composite glyph.
         int[] composedIndices = setupTest(408);
@@ -77,6 +81,7 @@ public class GlyfTableTestCase extends T
      *
      * @throws IOException if an I/O error occurs
      */
+    @Test
     public void testPopulateNoCompositeGlyphs() throws IOException {
         int[] composedIndices = setupTest(36, 37, 38); // "A", "B", "C"
         int[] expected = new int[composedIndices.length];
@@ -90,6 +95,7 @@ public class GlyfTableTestCase extends T
      *
      * @throws IOException if an I/O error occurs
      */
+    @Test
     public void testGlyphsNotRemappedTwice() throws IOException {
         int composedGlyph = 12;
         // The order of these glyph indices, must NOT be changed! (see javadoc above)
@@ -108,6 +114,7 @@ public class GlyfTableTestCase extends T
      *
      * @throws IOException if an I/O error occurs
      */
+    @Test
     public void testSingleRecursionStep() throws IOException {
         // Glyph 2077 -> U+283F "uni283F" this is composed of a composite glyph (recursive).
         int[] composedIndices = setupTest(2077);

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/fotreetest/FOTreeTestSuite.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/fotreetest/FOTreeTestSuite.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/fotreetest/FOTreeTestSuite.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/fotreetest/FOTreeTestSuite.java Tue Oct  4 10:09:01 2011
@@ -19,129 +19,20 @@
 
 package org.apache.fop.fotreetest;
 
-import java.io.File;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Iterator;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.filefilter.AndFileFilter;
-import org.apache.commons.io.filefilter.IOFileFilter;
-import org.apache.commons.io.filefilter.NameFileFilter;
-import org.apache.commons.io.filefilter.PrefixFileFilter;
-import org.apache.commons.io.filefilter.SuffixFileFilter;
-import org.apache.commons.io.filefilter.TrueFileFilter;
-
-import org.apache.fop.DebugHelper;
 import org.apache.fop.fo.flow.table.CollapsedConditionalBorderTestCase;
 import org.apache.fop.fo.flow.table.IllegalRowSpanTestCase;
 import org.apache.fop.fo.flow.table.RowGroupBuilderTestCase;
 import org.apache.fop.fo.flow.table.TableColumnColumnNumberTestCase;
 import org.apache.fop.fo.flow.table.TooManyColumnsTestCase;
-import org.apache.fop.layoutengine.LayoutEngineTestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
 
 /**
  * JUnit test suit for running layout engine test under JUnit control.
  */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({ TooManyColumnsTestCase.class, IllegalRowSpanTestCase.class,
+        RowGroupBuilderTestCase.class, TableColumnColumnNumberTestCase.class,
+        CollapsedConditionalBorderTestCase.class, FOTreeTester.class })
 public final class FOTreeTestSuite {
-
-    static {
-        DebugHelper.registerStandardElementListObservers();
-    }
-
-    private FOTreeTestSuite() {
-        //don't instantiate!
-    }
-
-    /**
-     * @return the test suite with all the tests (one for each XML file)
-     * @throws IOException in case of an I/O problem
-     */
-    public static Test suite() throws IOException {
-        TestSuite suite = new TestSuite();
-        addXMLTestCases(suite);
-        addUnitTestCases(suite);
-        return suite;
-    }
-
-    private static void addXMLTestCases(TestSuite suite) throws IOException {
-        File mainDir = new File("test/fotree");
-
-        final FOTreeTester tester = new FOTreeTester();
-
-        IOFileFilter filter;
-        String single = System.getProperty("fop.fotree.single");
-        String startsWith = System.getProperty("fop.fotree.starts-with");
-        if (single != null) {
-            filter = new NameFileFilter(single);
-        } else if (startsWith != null) {
-            filter = new PrefixFileFilter(startsWith);
-            filter = new AndFileFilter(filter, new SuffixFileFilter(".fo"));
-        } else {
-            filter = new SuffixFileFilter(".fo");
-            filter = LayoutEngineTestSuite.decorateWithDisabledList(filter);
-        }
-        Collection files = FileUtils.listFiles(new File(mainDir, "testcases"),
-                filter, TrueFileFilter.INSTANCE);
-        String privateTests = System.getProperty("fop.fotree.private");
-        if ("true".equalsIgnoreCase(privateTests)) {
-            Collection privateFiles = FileUtils.listFiles(
-                    new File(mainDir, "private-testcases"),
-                    filter, TrueFileFilter.INSTANCE);
-            files.addAll(privateFiles);
-        }
-        Iterator i = files.iterator();
-        while (i.hasNext()) {
-            File f = (File)i.next();
-            addTestCase(suite, tester, f);
-        }
-    }
-
-    private static void addTestCase(TestSuite suite,
-                final FOTreeTester tester, final File f) {
-        suite.addTest(new FOTreeTestCase(f.getName()) {
-            public void runTest() throws Exception {
-                try {
-                    prepare(tester, f);
-                    testMain();
-                } catch (Exception e) {
-                    org.apache.commons.logging.LogFactory.getLog(this.getClass()).info(
-                            "Error on " + f.getName());
-                    throw e;
-                }
-            }
-        });
-    }
-
-    private static void addUnitTestCases(TestSuite suite) {
-        suite.addTestSuite(TooManyColumnsTestCase.class);
-        suite.addTestSuite(IllegalRowSpanTestCase.class);
-        suite.addTestSuite(RowGroupBuilderTestCase.class);
-        suite.addTestSuite(TableColumnColumnNumberTestCase.class);
-        suite.addTestSuite(CollapsedConditionalBorderTestCase.class);
-    }
-
-    private static class FOTreeTestCase extends TestCase {
-
-        private FOTreeTester tester;
-        private File testFile;
-
-        public FOTreeTestCase(String name) {
-            super(name);
-        }
-
-        public void prepare(FOTreeTester tester, File testFile) {
-            //super(testFile.getName());
-            this.tester = tester;
-            this.testFile = testFile;
-        }
-
-        public void testMain() throws Exception {
-            tester.runTest(testFile);
-        }
-    }
 }

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/fotreetest/FOTreeTester.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/fotreetest/FOTreeTester.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/fotreetest/FOTreeTester.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/fotreetest/FOTreeTester.java Tue Oct  4 10:09:01 2011
@@ -20,88 +20,154 @@
 package org.apache.fop.fotreetest;
 
 import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
 import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLFilterImpl;
 
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.filefilter.AndFileFilter;
+import org.apache.commons.io.filefilter.IOFileFilter;
+import org.apache.commons.io.filefilter.NameFileFilter;
+import org.apache.commons.io.filefilter.PrefixFileFilter;
+import org.apache.commons.io.filefilter.SuffixFileFilter;
+import org.apache.commons.io.filefilter.TrueFileFilter;
+
+import org.apache.fop.DebugHelper;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.Fop;
 import org.apache.fop.apps.FopFactory;
 import org.apache.fop.apps.FopFactoryConfigurator;
 import org.apache.fop.fotreetest.ext.TestElementMapping;
+import org.apache.fop.layoutengine.LayoutEngineTestUtils;
 import org.apache.fop.util.ConsoleEventListenerForTests;
 
 /**
  * Test driver class for FO tree tests.
  */
+@RunWith(Parameterized.class)
 public class FOTreeTester {
 
+    @BeforeClass
+    public static void registerElementListObservers() {
+        DebugHelper.registerStandardElementListObservers();
+    }
+
+    @Parameters
+    public static Collection<File[]> testXMLTestCases() throws Exception {
+        File mainDir = new File("test/fotree");
+
+        IOFileFilter filter;
+        String single = System.getProperty("fop.fotree.single");
+        String startsWith = System.getProperty("fop.fotree.starts-with");
+        if (single != null) {
+            filter = new NameFileFilter(single);
+        } else if (startsWith != null) {
+            filter = new PrefixFileFilter(startsWith);
+            filter = new AndFileFilter(filter, new SuffixFileFilter(".fo"));
+        } else {
+            filter = new SuffixFileFilter(".fo");
+            filter = LayoutEngineTestUtils.decorateWithDisabledList(filter);
+        }
+        Collection<File> files = FileUtils.listFiles(new File(mainDir, "testcases"), filter,
+                TrueFileFilter.INSTANCE);
+        String privateTests = System.getProperty("fop.fotree.private");
+        if ("true".equalsIgnoreCase(privateTests)) {
+            Collection privateFiles = FileUtils.listFiles(new File(mainDir, "private-testcases"),
+                    filter, TrueFileFilter.INSTANCE);
+            files.addAll(privateFiles);
+        }
+        // Unfortunately JUnit forces us to return a collection of arrays.
+        Collection<File[]> parameters = new ArrayList<File[]>();
+        for (File f : files) {
+            parameters.add(new File[] { f });
+        }
+        return parameters;
+    }
+
     private FopFactory fopFactory = FopFactory.newInstance();
 
+    private final File testFile;
+
     /**
      * Main constructor
+     *
+     * @param testFile the FO file to test
      */
-    public FOTreeTester() {
+    public FOTreeTester(File testFile) {
         fopFactory.addElementMapping(new TestElementMapping());
+        this.testFile = testFile;
     }
 
     /**
      * Runs a test.
-     * @param testFile the test file.
      * @throws Exception if a test or FOP itself fails
      */
-    public void runTest(File testFile) throws Exception {
-        ResultCollector collector = ResultCollector.getInstance();
-        collector.reset();
-
-        SAXParserFactory spf = SAXParserFactory.newInstance();
-        spf.setNamespaceAware(true);
-        spf.setValidating(false);
-        SAXParser parser = spf.newSAXParser();
-        XMLReader reader = parser.getXMLReader();
-
-        //Resetting values modified by processing instructions
-        fopFactory.setBreakIndentInheritanceOnReferenceAreaBoundary(
-                FopFactoryConfigurator.DEFAULT_BREAK_INDENT_INHERITANCE);
-        fopFactory.setSourceResolution(FopFactoryConfigurator.DEFAULT_SOURCE_RESOLUTION);
-
-        FOUserAgent ua = fopFactory.newFOUserAgent();
-        ua.setBaseURL(testFile.getParentFile().toURI().toURL().toString());
-        ua.setFOEventHandlerOverride(new DummyFOEventHandler(ua));
-        ua.getEventBroadcaster().addEventListener(
-                new ConsoleEventListenerForTests(testFile.getName()));
-
-        //Used to set values in the user agent through processing instructions
-        reader = new PIListener(reader, ua);
-
-        Fop fop = fopFactory.newFop(ua);
-
-        reader.setContentHandler(fop.getDefaultHandler());
-        reader.setDTDHandler(fop.getDefaultHandler());
-        reader.setErrorHandler(fop.getDefaultHandler());
-        reader.setEntityResolver(fop.getDefaultHandler());
+    @Test
+    public void runTest() throws Exception {
         try {
-            reader.parse(testFile.toURI().toURL().toExternalForm());
-        } catch (Exception e) {
-            collector.notifyError(e.getLocalizedMessage());
-            throw e;
-        }
+            ResultCollector collector = ResultCollector.getInstance();
+            collector.reset();
 
-        List results = collector.getResults();
-        if (results.size() > 0) {
-            for (int i = 0; i < results.size(); i++) {
-                System.out.println((String)results.get(i));
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            spf.setValidating(false);
+            SAXParser parser = spf.newSAXParser();
+            XMLReader reader = parser.getXMLReader();
+
+            // Resetting values modified by processing instructions
+            fopFactory.setBreakIndentInheritanceOnReferenceAreaBoundary(
+                    FopFactoryConfigurator.DEFAULT_BREAK_INDENT_INHERITANCE);
+            fopFactory.setSourceResolution(FopFactoryConfigurator.DEFAULT_SOURCE_RESOLUTION);
+
+            FOUserAgent ua = fopFactory.newFOUserAgent();
+            ua.setBaseURL(testFile.getParentFile().toURI().toURL().toString());
+            ua.setFOEventHandlerOverride(new DummyFOEventHandler(ua));
+            ua.getEventBroadcaster().addEventListener(
+                    new ConsoleEventListenerForTests(testFile.getName()));
+
+            // Used to set values in the user agent through processing instructions
+            reader = new PIListener(reader, ua);
+
+            Fop fop = fopFactory.newFop(ua);
+
+            reader.setContentHandler(fop.getDefaultHandler());
+            reader.setDTDHandler(fop.getDefaultHandler());
+            reader.setErrorHandler(fop.getDefaultHandler());
+            reader.setEntityResolver(fop.getDefaultHandler());
+            try {
+                reader.parse(testFile.toURI().toURL().toExternalForm());
+            } catch (Exception e) {
+                collector.notifyError(e.getLocalizedMessage());
+                throw e;
             }
-            throw new IllegalStateException((String)results.get(0));
+
+            List results = collector.getResults();
+            if (results.size() > 0) {
+                for (int i = 0; i < results.size(); i++) {
+                    System.out.println((String) results.get(i));
+                }
+                throw new IllegalStateException((String) results.get(0));
+            }
+        } catch (Exception e) {
+            org.apache.commons.logging.LogFactory.getLog(this.getClass()).info(
+                    "Error on " + testFile.getName());
+            throw e;
         }
     }
 
-    private class PIListener extends XMLFilterImpl {
+    private static class PIListener extends XMLFilterImpl {
 
         private FOUserAgent userAgent;
 

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/fotreetest/FOTreeUnitTester.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/fotreetest/FOTreeUnitTester.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/fotreetest/FOTreeUnitTester.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/fotreetest/FOTreeUnitTester.java Tue Oct  4 10:09:01 2011
@@ -24,15 +24,12 @@ import java.io.File;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 
-import junit.framework.TestCase;
-
-import org.xml.sax.XMLReader;
-
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.Fop;
 import org.apache.fop.apps.FopFactory;
 import org.apache.fop.fo.FOEventHandler;
 import org.apache.fop.util.ConsoleEventListenerForTests;
+import org.xml.sax.XMLReader;
 
 
 /**
@@ -40,7 +37,7 @@ import org.apache.fop.util.ConsoleEventL
  * to parse an FO file and register a proper {@link FOEventHandler}. That handler will be
  * the entry point to test classes from the FObj hierarchy.
  */
-public abstract class FOTreeUnitTester extends TestCase {
+public abstract class FOTreeUnitTester {
 
     private XMLReader foReader;
 

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/image/loader/batik/ImageLoaderTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/image/loader/batik/ImageLoaderTestCase.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/image/loader/batik/ImageLoaderTestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/image/loader/batik/ImageLoaderTestCase.java Tue Oct  4 10:09:01 2011
@@ -19,12 +19,14 @@
 
 package org.apache.fop.image.loader.batik;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
 import java.awt.image.Raster;
 import java.awt.image.RenderedImage;
 import java.io.File;
 
-import junit.framework.TestCase;
-
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.FopFactory;
 import org.apache.xmlgraphics.image.loader.Image;
@@ -35,23 +37,24 @@ import org.apache.xmlgraphics.image.load
 import org.apache.xmlgraphics.image.loader.impl.ImageRendered;
 import org.apache.xmlgraphics.image.loader.impl.ImageXMLDOM;
 import org.apache.xmlgraphics.image.writer.ImageWriterUtil;
+import org.junit.Test;
 
 /**
  * Tests for bundled ImageLoader implementations.
  */
-public class ImageLoaderTestCase extends TestCase {
+public class ImageLoaderTestCase {
 
     private static final File DEBUG_TARGET_DIR = null; //new File("D:/");
 
     private FopFactory fopFactory;
 
-    public ImageLoaderTestCase(String name) {
-        super(name);
+    public ImageLoaderTestCase() {
         fopFactory = FopFactory.newInstance();
         fopFactory.setSourceResolution(72);
         fopFactory.setTargetResolution(300);
     }
 
+    @Test
     public void testSVG() throws Exception {
         String uri = "test/resources/images/img-w-size.svg";
 
@@ -90,6 +93,7 @@ public class ImageLoaderTestCase extends
         assertEquals(16000, info.getSize().getHeightMpt());
     }
 
+    @Test
     public void testSVGNoViewbox() throws Exception {
         String uri = "test/resources/images/circles.svg";
 
@@ -135,6 +139,7 @@ public class ImageLoaderTestCase extends
         assertEquals(340158, info.getSize().getHeightMpt());
     }
 
+    @Test
     public void testWMF() throws Exception {
         String uri = "test/resources/images/testChart.wmf";
 
@@ -162,6 +167,7 @@ public class ImageLoaderTestCase extends
         assertEquals(612000, info.getSize().getHeightMpt());
     }
 
+    @Test
     public void testSVGWithReferences() throws Exception {
         String uri = "test/resources/fop/svg/images.svg";
         FopFactory ff = FopFactory.newInstance();
@@ -213,7 +219,4 @@ public class ImageLoaderTestCase extends
         }
         assertFalse("Embedding JPG into SVG failed", same);
     }
-
-
-    
 }

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/image/loader/batik/ImagePreloaderTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/image/loader/batik/ImagePreloaderTestCase.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/image/loader/batik/ImagePreloaderTestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/image/loader/batik/ImagePreloaderTestCase.java Tue Oct  4 10:09:01 2011
@@ -19,6 +19,9 @@
 
 package org.apache.fop.image.loader.batik;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
 import java.io.IOException;
 
 import javax.xml.transform.Source;
@@ -26,42 +29,39 @@ import javax.xml.transform.TransformerEx
 import javax.xml.transform.URIResolver;
 import javax.xml.transform.dom.DOMSource;
 
-import junit.framework.TestCase;
-
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
 import org.apache.batik.dom.svg.SVGDOMImplementation;
-
-import org.apache.xmlgraphics.image.loader.ImageException;
-import org.apache.xmlgraphics.image.loader.ImageInfo;
-import org.apache.xmlgraphics.image.loader.ImageManager;
-
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.FopFactory;
 import org.apache.fop.apps.MimeConstants;
+import org.apache.xmlgraphics.image.loader.ImageException;
+import org.apache.xmlgraphics.image.loader.ImageInfo;
+import org.apache.xmlgraphics.image.loader.ImageManager;
+import org.junit.Test;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
 
 /**
  * Tests for bundled image preloader implementations.
  */
-public class ImagePreloaderTestCase extends TestCase {
+public class ImagePreloaderTestCase {
 
     private FopFactory fopFactory;
 
-    public ImagePreloaderTestCase(String name) {
-        super(name);
+    public ImagePreloaderTestCase() {
         fopFactory = FopFactory.newInstance();
         fopFactory.setSourceResolution(72);
         fopFactory.setTargetResolution(300);
     }
 
+    @Test
     public void testSVG() throws Exception {
         String uri = "test/resources/images/img-w-size.svg";
 
         checkSVGFile(uri);
     }
 
+    @Test
     public void testSVGZ() throws Exception {
         String uri = "test/resources/images/img-w-size.svgz";
 
@@ -83,6 +83,7 @@ public class ImagePreloaderTestCase exte
         assertEquals(16000, info.getSize().getHeightMpt());
     }
 
+    @Test
     public void testSVGNoSize() throws Exception {
         String uri = "test/resources/images/img.svg";
         FOUserAgent userAgent = fopFactory.newFOUserAgent();
@@ -99,6 +100,7 @@ public class ImagePreloaderTestCase exte
         assertEquals(100000, info.getSize().getHeightMpt());
     }
 
+    @Test
     public void testSVGWithDOM() throws Exception {
         String uri = "my:SVGImage";
         FOUserAgent userAgent = fopFactory.newFOUserAgent();
@@ -143,6 +145,7 @@ public class ImagePreloaderTestCase exte
         assertEquals(20000, info.getSize().getHeightMpt());
     }
 
+    @Test
     public void testWMF() throws Exception {
         String uri = "test/resources/images/testChart.wmf";
 

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/AbstractIntermediateTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/AbstractIntermediateTestCase.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/AbstractIntermediateTestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/AbstractIntermediateTestCase.java Tue Oct  4 10:09:01 2011
@@ -33,7 +33,9 @@ import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerException;
 import javax.xml.transform.dom.DOMSource;
 
-import org.custommonkey.xmlunit.XMLTestCase;
+import org.custommonkey.xmlunit.XMLAssert;
+import org.junit.After;
+import org.junit.Before;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
@@ -49,7 +51,7 @@ import org.apache.fop.util.ConsoleEventL
 /**
  * Abstract base class for intermediate format tests.
  */
-public abstract class AbstractIntermediateTestCase extends XMLTestCase {
+public abstract class AbstractIntermediateTestCase {
 
     /** the test environment */
     protected static TestAssistant testAssistant = new TestAssistant();
@@ -76,30 +78,27 @@ public abstract class AbstractIntermedia
      */
     public AbstractIntermediateTestCase(File testFile)
             throws IOException {
-        super(testFile.getName());
         this.testFile = testFile;
     }
 
-    /** {@inheritDoc} */
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void setUp() throws Exception {
         setupOutputDirectory();
         this.testDoc = testAssistant.loadTestCase(testFile);
         this.fopFactory = testAssistant.getFopFactory(testDoc);
         intermediate = buildIntermediateDocument(testAssistant.getTestcase2FOStylesheet());
         if (outputDir != null) {
             testAssistant.saveDOM(intermediate, new File(outputDir,
-                    getName() + ".1" + getIntermediateFileExtension()));
+                    testFile.getName() + ".1" + getIntermediateFileExtension()));
         }
     }
 
-    /** {@inheritDoc} */
-    protected void tearDown() throws Exception {
+    @After
+    public void tearDown() throws Exception {
         //Release memory
         this.intermediate = null;
         this.fopFactory = null;
         this.testDoc = null;
-        super.tearDown();
     }
 
     /**
@@ -172,11 +171,12 @@ public abstract class AbstractIntermedia
         Source src = new DOMSource(intermediate);
         Document doc = parseAndRenderToIntermediateFormat(src);
         if (outputDir != null) {
-            File tgtFile = new File(outputDir, getName() + ".2" + getIntermediateFileExtension());
+            File tgtFile = new File(outputDir, testFile.getName() + ".2"
+                    + getIntermediateFileExtension());
             testAssistant.saveDOM(doc, tgtFile);
         }
 
-        assertXMLEqual(intermediate, doc);
+        XMLAssert.assertXMLEqual(intermediate, doc);
     }
 
     /**
@@ -195,7 +195,7 @@ public abstract class AbstractIntermedia
     public void testParserToPDF() throws Exception {
         OutputStream out;
         if (outputDir != null) {
-            File tgtFile = new File(outputDir, getName() + ".pdf");
+            File tgtFile = new File(outputDir, testFile.getName() + ".pdf");
             out = new FileOutputStream(tgtFile);
             out = new BufferedOutputStream(out);
         } else {
@@ -219,6 +219,13 @@ public abstract class AbstractIntermedia
             throws Exception;
 
     /**
+     * Run the test.
+     *
+     * @throws Exception if an error occurs during the test
+     */
+    public abstract void runTest() throws Exception;
+
+    /**
      * Sets an error listener which doesn't swallow errors like Xalan's default one.
      * @param transformer the transformer to set the error listener on
      */

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java Tue Oct  4 10:09:01 2011
@@ -22,6 +22,7 @@ package org.apache.fop.intermediate;
 import java.io.File;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Collection;
 
 import javax.xml.transform.Result;
 import javax.xml.transform.Source;
@@ -32,25 +33,39 @@ import javax.xml.transform.dom.DOMSource
 import javax.xml.transform.sax.SAXResult;
 import javax.xml.transform.sax.TransformerHandler;
 
-import org.w3c.dom.Document;
-
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.Fop;
-import org.apache.fop.apps.FopFactory;
 import org.apache.fop.apps.MimeConstants;
 import org.apache.fop.area.AreaTreeModel;
 import org.apache.fop.area.AreaTreeParser;
 import org.apache.fop.area.RenderPagesModel;
 import org.apache.fop.fonts.FontInfo;
+import org.apache.fop.layoutengine.LayoutEngineTestUtils;
 import org.apache.fop.render.Renderer;
 import org.apache.fop.render.xml.XMLRenderer;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.w3c.dom.Document;
 
 /**
  * Tests the area tree parser.
  */
+@RunWith(Parameterized.class)
 public class AreaTreeParserTestCase extends AbstractIntermediateTestCase {
 
     /**
+     * Creates the parameters for this test.
+     *
+     * @return the list of file arrays populated with test files
+     * @throws IOException if an I/O error occurs while reading the test file
+     */
+    @Parameters
+    public static Collection<File[]> getParameters() throws IOException {
+        return LayoutEngineTestUtils.getTestFiles();
+    }
+    /**
      * Constructor for the test suite that is used for each test file.
      * @param testFile the test file to run
      * @throws IOException
@@ -132,4 +147,17 @@ public class AreaTreeParserTestCase exte
         return (Document)domResult.getNode();
     }
 
+    @Override
+    @Test
+    public void runTest() throws Exception {
+        try {
+            testParserToIntermediateFormat();
+            testParserToPDF();
+        } catch (Exception e) {
+            org.apache.commons.logging.LogFactory.getLog(this.getClass()).error(
+                    "Error on " + testFile.getName());
+            throw e;
+        }
+    }
+
 }

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/AreaTreeXMLFormatTestSuite.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/AreaTreeXMLFormatTestSuite.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/AreaTreeXMLFormatTestSuite.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/AreaTreeXMLFormatTestSuite.java Tue Oct  4 10:09:01 2011
@@ -19,53 +19,14 @@
 
 package org.apache.fop.intermediate;
 
-import java.io.File;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Iterator;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.apache.fop.layoutengine.LayoutEngineTestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
 
 /**
  * JUnit test suite for the area tree XML format
  */
+@RunWith(Suite.class)
+@SuiteClasses({ AreaTreeParserTestCase.class })
 public class AreaTreeXMLFormatTestSuite {
-
-    /**
-     * @return the test suite with all the tests (one for each XML file)
-     * @throws IOException in case of an I/O problem
-     */
-    public static Test suite() throws IOException {
-        TestSuite suite = new TestSuite();
-
-        Collection files = LayoutEngineTestSuite.getTestFiles();
-
-        Iterator i = files.iterator();
-        while (i.hasNext()) {
-            File f = (File)i.next();
-            addATTestCase(suite, f);
-        }
-
-        return suite;
-    }
-
-    private static void addATTestCase(TestSuite suite,
-            final File f) throws IOException {
-        suite.addTest(new AreaTreeParserTestCase(f) {
-            public void runTest() throws Exception {
-                try {
-                    testParserToIntermediateFormat();
-                    testParserToPDF();
-                } catch (Exception e) {
-                    org.apache.commons.logging.LogFactory.getLog(
-                            this.getClass()).error("Error on " + f.getName());
-                    throw e;
-                }
-            }
-        });
-    }
-
 }

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/IFMimickingTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/IFMimickingTestCase.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/IFMimickingTestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/IFMimickingTestCase.java Tue Oct  4 10:09:01 2011
@@ -19,6 +19,8 @@
 
 package org.apache.fop.intermediate;
 
+import static org.junit.Assert.fail;
+
 import java.io.File;
 
 import javax.xml.transform.ErrorListener;
@@ -29,7 +31,8 @@ import javax.xml.transform.dom.DOMResult
 import javax.xml.transform.sax.SAXResult;
 import javax.xml.transform.stream.StreamSource;
 
-import junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
 
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.FOUserAgent;
@@ -48,13 +51,12 @@ import org.apache.fop.render.intermediat
 /**
  * This test checks the correct mimicking of a different output format.
  */
-public class IFMimickingTestCase extends TestCase {
+public class IFMimickingTestCase {
 
     private FopFactory fopFactory;
 
-    /** {@inheritDoc} */
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void setUp() throws Exception {
         fopFactory = FopFactory.newInstance();
         File configFile = new File("test/test-no-xml-metrics.xconf");
         fopFactory.setUserConfig(configFile);
@@ -64,6 +66,7 @@ public class IFMimickingTestCase extends
      * Tests IF document handler mimicking with PDF output.
      * @throws Exception if an error occurs
      */
+    @Test
     public void testMimickingPDF() throws Exception {
         doTestMimicking(MimeConstants.MIME_PDF);
     }
@@ -72,6 +75,7 @@ public class IFMimickingTestCase extends
      * Tests IF document handler mimicking with PostScript output.
      * @throws Exception if an error occurs
      */
+    @Test
     public void testMimickingPS() throws Exception {
         doTestMimicking(MimeConstants.MIME_POSTSCRIPT);
     }
@@ -80,6 +84,7 @@ public class IFMimickingTestCase extends
      * Tests IF document handler mimicking with TIFF output.
      * @throws Exception if an error occurs
      */
+    @Test
     public void testMimickingTIFF() throws Exception {
         doTestMimicking(MimeConstants.MIME_TIFF);
     }

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/IFParserTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/IFParserTestCase.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/IFParserTestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/IFParserTestCase.java Tue Oct  4 10:09:01 2011
@@ -22,15 +22,21 @@ package org.apache.fop.intermediate;
 import java.io.File;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Collection;
 
 import javax.xml.transform.Source;
 import javax.xml.transform.dom.DOMResult;
 import javax.xml.transform.stream.StreamResult;
 
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
 import org.w3c.dom.Document;
 
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.fonts.FontInfo;
+import org.apache.fop.layoutengine.LayoutEngineTestUtils;
 import org.apache.fop.render.intermediate.IFContext;
 import org.apache.fop.render.intermediate.IFDocumentHandler;
 import org.apache.fop.render.intermediate.IFParser;
@@ -39,9 +45,21 @@ import org.apache.fop.render.intermediat
 /**
  * Tests the intermediate format parser.
  */
+@RunWith(Parameterized.class)
 public class IFParserTestCase extends AbstractIFTestCase {
 
     /**
+     * Gets the parameters for this test
+     *
+     * @return a collection of file arrays containing the test files
+     * @throws IOException if an error occurs when trying to read the test files
+     */
+    @Parameters
+    public static Collection<File[]> getParameters() throws IOException {
+        return LayoutEngineTestUtils.getTestFiles();
+    }
+
+    /**
      * Constructor for the test suite that is used for each test file.
      * @param testFile the test file to run
      * @throws IOException if an I/O error occurs while loading the test case
@@ -81,11 +99,16 @@ public class IFParserTestCase extends Ab
         return (Document)domResult.getNode();
     }
 
-    /** {@inheritDoc} */
     @Override
+    @Test
     public void runTest() throws Exception {
-        testParserToIntermediateFormat();
-        testParserToPDF();
+        try {
+            testParserToIntermediateFormat();
+            testParserToPDF();
+        } catch (Exception e) {
+            org.apache.commons.logging.LogFactory.getLog(this.getClass()).error(
+                    "Error on " + testFile.getName());
+            throw e;
+        }
     }
-
 }

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/IFTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/IFTestCase.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/IFTestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/IFTestCase.java Tue Oct  4 10:09:01 2011
@@ -20,11 +20,20 @@
 package org.apache.fop.intermediate;
 
 import java.io.File;
+import java.io.FilenameFilter;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Collection;
 
 import javax.xml.transform.Source;
+import javax.xml.transform.TransformerFactory;
 
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
@@ -33,9 +42,40 @@ import org.w3c.dom.NodeList;
 /**
  * Test case for the IF output.
  */
+@RunWith(Parameterized.class)
 public class IFTestCase extends AbstractIFTestCase {
 
-    private final IFTester ifTester;
+    /**
+     * Gets the files for this test.
+     *
+     * @return a collection of file arrays containing the files to test
+     * @throws IOException if an error occurs when reading the test files
+     */
+    @Parameters
+    public static Collection<File[]> getParameters() throws IOException {
+        File testDir = new File("test/intermediate");
+        String[] tests = testDir.list(new FilenameFilter() {
+
+            public boolean accept(File dir, String name) {
+                return name.endsWith(".xml");
+            }
+        });
+
+        Collection<File[]> parameters = new ArrayList<File[]>();
+        for (String test : tests) {
+            parameters.add(new File[] { new File(testDir, test) });
+        }
+        return parameters;
+    }
+
+    private static IFTester ifTester;
+
+    @BeforeClass
+    public static void setupTestEnvironment() {
+        File backupDir = new File("build/test-results/intermediate");
+        backupDir.mkdirs();
+        ifTester = new IFTester(TransformerFactory.newInstance(), backupDir);
+    }
 
     /**
      * Creates a new test case.
@@ -44,15 +84,14 @@ public class IFTestCase extends Abstract
      * @param ifTester the helper instance that will perform checks
      * @throws IOException if an I/O error occurs while loading the test case
      */
-    public IFTestCase(File test, IFTester ifTester) throws IOException {
+    public IFTestCase(File test) throws IOException {
         super(test);
-        this.ifTester = ifTester;
         this.testDir = test.getParentFile();
     }
 
-    /** {@inheritDoc} */
     @Override
-    protected void runTest() throws Exception {
+    @Test
+    public void runTest() throws Exception {
         Element testRoot = testAssistant.getTestRoot(testFile);
         NodeList nodes = testRoot.getElementsByTagName("if-checks");
         if (nodes.getLength() == 0) {
@@ -61,7 +100,7 @@ public class IFTestCase extends Abstract
         Element ifChecks = (Element) nodes.item(0);
 
         Document doc = buildIntermediateDocument(testAssistant.getTestcase2FOStylesheet());
-        ifTester.doIFChecks(getName(), ifChecks, doc);
+        ifTester.doIFChecks(testFile.getName(), ifChecks, doc);
     }
 
     @Override

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/IntermediateFormatTestSuite.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/IntermediateFormatTestSuite.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/IntermediateFormatTestSuite.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/IntermediateFormatTestSuite.java Tue Oct  4 10:09:01 2011
@@ -19,49 +19,14 @@
 
 package org.apache.fop.intermediate;
 
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-
-import javax.xml.transform.TransformerFactory;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
 
 /**
  * A test suite for testing the Intermediate Format output.
  */
+@RunWith(Suite.class)
+@SuiteClasses({ IFTestCase.class })
 public final class IntermediateFormatTestSuite {
-
-    private IntermediateFormatTestSuite() {
-        // This is a utility class
-    }
-
-    /**
-     * Creates a suite of Intermediate Format tests.
-     *
-     * @return the test suite
-     * @throws IOException if an I/O error occurs while loading one of the tests
-     */
-    public static Test suite() throws IOException {
-
-        File backupDir = new File("build/test-results/intermediate");
-        backupDir.mkdirs();
-
-        IFTester ifTester = new IFTester(TransformerFactory.newInstance(), backupDir);
-
-        TestSuite suite = new TestSuite();
-        File testDir = new File("test/intermediate");
-        String[] tests = testDir.list(new FilenameFilter() {
-
-            public boolean accept(File dir, String name) {
-                return name.endsWith(".xml");
-            }
-        });
-        for (String test : tests) {
-            File testFile = new File(testDir, test);
-            suite.addTest(new IFTestCase(testFile, ifTester));
-        }
-        return suite;
-    }
 }

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/LayoutIFTestSuite.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/LayoutIFTestSuite.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/LayoutIFTestSuite.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/LayoutIFTestSuite.java Tue Oct  4 10:09:01 2011
@@ -19,46 +19,14 @@
 
 package org.apache.fop.intermediate;
 
-import java.io.File;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Iterator;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.apache.fop.layoutengine.LayoutEngineTestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
 
 /**
  * JUnit test suite for the intermediate format
  */
+@RunWith(Suite.class)
+@SuiteClasses({ IFParserTestCase.class })
 public final class LayoutIFTestSuite {
-
-    private LayoutIFTestSuite() {
-        // This is a utility class
-    }
-
-    /**
-     * @return the test suite with all the tests (one for each XML file)
-     * @throws IOException in case of an I/O problem
-     */
-    public static Test suite() throws IOException {
-        TestSuite suite = new TestSuite();
-
-        Collection files = LayoutEngineTestSuite.getTestFiles();
-
-        Iterator i = files.iterator();
-        while (i.hasNext()) {
-            File f = (File)i.next();
-            addIFTestCase(suite, f);
-        }
-
-        return suite;
-    }
-
-    private static void addIFTestCase(TestSuite suite,
-            final File f) throws IOException {
-        suite.addTest(new IFParserTestCase(f));
-    }
-
 }

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java Tue Oct  4 10:09:01 2011
@@ -19,196 +19,14 @@
 
 package org.apache.fop.layoutengine;
 
-import java.io.File;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.sax.SAXResult;
-import javax.xml.transform.stream.StreamSource;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.filefilter.AndFileFilter;
-import org.apache.commons.io.filefilter.IOFileFilter;
-import org.apache.commons.io.filefilter.NameFileFilter;
-import org.apache.commons.io.filefilter.NotFileFilter;
-import org.apache.commons.io.filefilter.PrefixFileFilter;
-import org.apache.commons.io.filefilter.SuffixFileFilter;
-import org.apache.commons.io.filefilter.TrueFileFilter;
-
-import org.apache.fop.DebugHelper;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
 
 /**
  * JUnit test suit for running layout engine test under JUnit control.
  */
-public final class LayoutEngineTestSuite {
-
-    static {
-        DebugHelper.registerStandardElementListObservers();
-    }
-
-    private LayoutEngineTestSuite() {
-        // This is a utility class
-    }
-
-    public static String[] readDisabledTestcases(File f) throws IOException {
-        List lines = new java.util.ArrayList();
-        Source stylesheet = new StreamSource(
-                new File("test/layoutengine/disabled-testcase2filename.xsl"));
-        Source source = new StreamSource(f);
-        Result result = new SAXResult(new FilenameHandler(lines));
-        try {
-            Transformer transformer = TransformerFactory.newInstance().newTransformer(stylesheet);
-            transformer.transform(source, result);
-        } catch (TransformerConfigurationException tce) {
-            throw new RuntimeException(tce.getMessage());
-        } catch (TransformerException te) {
-            throw new RuntimeException(te.getMessage());
-        }
-        return (String[])lines.toArray(new String[lines.size()]);
-    }
-
-    private static class FilenameHandler extends DefaultHandler {
-        private StringBuffer buffer = new StringBuffer(128);
-        private boolean readingFilename = false;
-        private List filenames;
-
-        public FilenameHandler(List filenames) {
-            this.filenames = filenames;
-        }
-
-        public void startElement(String namespaceURI, String localName, String qName,
-                Attributes atts) throws SAXException {
-            if (qName != null && qName.equals("file")) {
-                buffer.setLength(0);
-                readingFilename = true;
-            } else {
-                throw new RuntimeException(
-                        "Unexpected element while reading disabled testcase file names: " + qName);
-            }
-        }
-
-        public void endElement(String namespaceURI, String localName, String qName)
-                    throws SAXException {
-            if (qName != null && qName.equals("file")) {
-                readingFilename = false;
-                filenames.add(buffer.toString());
-            } else {
-                throw new RuntimeException(
-                        "Unexpected element while reading disabled testcase file names: " + qName);
-            }
-        }
-
-        public void characters(char[] ch, int start, int length) throws SAXException {
-            if (readingFilename) {
-                buffer.append(ch, start, length);
-            }
-        }
-    }
-
-    public static IOFileFilter decorateWithDisabledList(IOFileFilter filter) throws IOException {
-        String disabled = System.getProperty("fop.layoutengine.disabled");
-        if (disabled != null && disabled.length() > 0) {
-            filter = new AndFileFilter(new NotFileFilter(
-                           new NameFileFilter(readDisabledTestcases(new File(disabled)))),
-                    filter);
-        }
-        return filter;
-    }
-
-    /**
-     * @return a Collection of File instances containing all the test cases set up for processing.
-     * @throws IOException if there's a problem gathering the list of test files
-     */
-    public static Collection getTestFiles() throws IOException {
-        File mainDir = new File("test/layoutengine");
-        IOFileFilter filter;
-        String single = System.getProperty("fop.layoutengine.single");
-        String startsWith = System.getProperty("fop.layoutengine.starts-with");
-        if (single != null) {
-            filter = new NameFileFilter(single);
-        } else if (startsWith != null) {
-            filter = new PrefixFileFilter(startsWith);
-            filter = new AndFileFilter(filter, new SuffixFileFilter(".xml"));
-            filter = decorateWithDisabledList(filter);
-        } else {
-            filter = new SuffixFileFilter(".xml");
-            filter = decorateWithDisabledList(filter);
-        }
-        String testset = System.getProperty("fop.layoutengine.testset");
-        if (testset == null) {
-            testset = "standard";
-        }
-        Collection files = FileUtils.listFiles(new File(mainDir, testset + "-testcases"),
-                filter, TrueFileFilter.INSTANCE);
-        String privateTests = System.getProperty("fop.layoutengine.private");
-        if ("true".equalsIgnoreCase(privateTests)) {
-            Collection privateFiles = FileUtils.listFiles(
-                    new File(mainDir, "private-testcases"),
-                    filter, TrueFileFilter.INSTANCE);
-            files.addAll(privateFiles);
-        }
-        return files;
-    }
-
-    /**
-     * @return the test suite with all the tests (one for each XML file)
-     * @throws IOException in case of an I/O problem
-     */
-    public static Test suite() throws IOException {
-        TestSuite suite = new TestSuite();
-
-        File backupDir = new File("build/test-results/layoutengine");
-        backupDir.mkdirs();
-
-        Collection files = getTestFiles();
-
-        final LayoutEngineTester tester = new LayoutEngineTester(backupDir);
-        Iterator i = files.iterator();
-        while (i.hasNext()) {
-            File f = (File)i.next();
-            suite.addTest(new LayoutEngineTestCase(f, tester));
-        }
-
-        return suite;
-    }
-
-    private static class LayoutEngineTestCase extends TestCase {
-
-        private final File testFile;
-
-        private final LayoutEngineTester tester;
-
-        LayoutEngineTestCase(File testFile, LayoutEngineTester tester) {
-            super(testFile.getName());
-            this.testFile = testFile;
-            this.tester = tester;
-        }
-
-        @Override
-        protected void runTest() throws Throwable {
-            try {
-                tester.runTest(testFile);
-            } catch (Exception e) {
-                org.apache.commons.logging.LogFactory.getLog(
-                        this.getClass()).error("Error on " + getName());
-                throw e;
-            }
-        }
-    }
+@RunWith(Suite.class)
+@SuiteClasses({ LayoutEngineTester.class })
+public class LayoutEngineTestSuite {
 }

Added: xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/LayoutEngineTestUtils.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/LayoutEngineTestUtils.java?rev=1178747&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/LayoutEngineTestUtils.java (added)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/LayoutEngineTestUtils.java Tue Oct  4 10:09:01 2011
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.layoutengine;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.filefilter.AndFileFilter;
+import org.apache.commons.io.filefilter.IOFileFilter;
+import org.apache.commons.io.filefilter.NameFileFilter;
+import org.apache.commons.io.filefilter.NotFileFilter;
+import org.apache.commons.io.filefilter.PrefixFileFilter;
+import org.apache.commons.io.filefilter.SuffixFileFilter;
+import org.apache.commons.io.filefilter.TrueFileFilter;
+
+/**
+ * Utility class for layout engine tests.
+ */
+public final class LayoutEngineTestUtils {
+
+    private LayoutEngineTestUtils() {
+    }
+
+    private static class FilenameHandler extends DefaultHandler {
+        private StringBuffer buffer = new StringBuffer(128);
+        private boolean readingFilename = false;
+        private List filenames;
+
+        public FilenameHandler(List filenames) {
+            this.filenames = filenames;
+        }
+
+        public void startElement(String namespaceURI, String localName, String qName,
+                Attributes atts) throws SAXException {
+            if (qName != null && qName.equals("file")) {
+                buffer.setLength(0);
+                readingFilename = true;
+            } else {
+                throw new RuntimeException(
+                        "Unexpected element while reading disabled testcase file names: " + qName);
+            }
+        }
+
+        public void endElement(String namespaceURI, String localName, String qName)
+                throws SAXException {
+            if (qName != null && qName.equals("file")) {
+                readingFilename = false;
+                filenames.add(buffer.toString());
+            } else {
+                throw new RuntimeException(
+                        "Unexpected element while reading disabled testcase file names: " + qName);
+            }
+        }
+
+        public void characters(char[] ch, int start, int length) throws SAXException {
+            if (readingFilename) {
+                buffer.append(ch, start, length);
+            }
+        }
+    }
+
+    public static IOFileFilter decorateWithDisabledList(IOFileFilter filter) throws IOException {
+        String disabled = System.getProperty("fop.layoutengine.disabled");
+        if (disabled != null && disabled.length() > 0) {
+            filter = new AndFileFilter(new NotFileFilter(
+                    new NameFileFilter(LayoutEngineTestUtils.readDisabledTestcases(new File(
+                            disabled)))),
+                    filter);
+        }
+        return filter;
+    }
+
+    public static String[] readDisabledTestcases(File f) throws IOException {
+        List lines = new java.util.ArrayList();
+        Source stylesheet = new StreamSource(
+                new File("test/layoutengine/disabled-testcase2filename.xsl"));
+        Source source = new StreamSource(f);
+        Result result = new SAXResult(new FilenameHandler(lines));
+        try {
+            Transformer transformer = TransformerFactory.newInstance().newTransformer(stylesheet);
+            transformer.transform(source, result);
+        } catch (TransformerConfigurationException tce) {
+            throw new RuntimeException(tce.getMessage());
+        } catch (TransformerException te) {
+            throw new RuntimeException(te.getMessage());
+        }
+        return (String[]) lines.toArray(new String[lines.size()]);
+    }
+
+    /**
+     * @return a Collection of File instances containing all the test cases set up for processing.
+     * @throws IOException if there's a problem gathering the list of test files
+     */
+    public static Collection<File[]> getTestFiles() throws IOException {
+        File mainDir = new File("test/layoutengine");
+        IOFileFilter filter;
+        String single = System.getProperty("fop.layoutengine.single");
+        String startsWith = System.getProperty("fop.layoutengine.starts-with");
+        if (single != null) {
+            filter = new NameFileFilter(single);
+        } else if (startsWith != null) {
+            filter = new PrefixFileFilter(startsWith);
+            filter = new AndFileFilter(filter, new SuffixFileFilter(".xml"));
+            filter = decorateWithDisabledList(filter);
+        } else {
+            filter = new SuffixFileFilter(".xml");
+            filter = decorateWithDisabledList(filter);
+        }
+        String testset = System.getProperty("fop.layoutengine.testset");
+        if (testset == null) {
+            testset = "standard";
+        }
+        Collection<File> files = FileUtils.listFiles(new File(mainDir, testset + "-testcases"),
+                filter, TrueFileFilter.INSTANCE);
+        String privateTests = System.getProperty("fop.layoutengine.private");
+        if ("true".equalsIgnoreCase(privateTests)) {
+            Collection privateFiles = FileUtils.listFiles(
+                    new File(mainDir, "private-testcases"),
+                    filter, TrueFileFilter.INSTANCE);
+            files.addAll(privateFiles);
+        }
+
+        Collection<File[]> parametersForJUnit4 = new ArrayList<File[]>();
+        for (File f : files) {
+            parametersForJUnit4.add(new File[] { f });
+        }
+
+        return parametersForJUnit4;
+    }
+
+}

Propchange: xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/LayoutEngineTestUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/LayoutEngineTestUtils.java
------------------------------------------------------------------------------
    svn:keywords = Revision Id

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java Tue Oct  4 10:09:01 2011
@@ -21,6 +21,7 @@ package org.apache.fop.layoutengine;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.Collection;
 import java.util.List;
 
 import javax.xml.parsers.ParserConfigurationException;
@@ -33,12 +34,7 @@ import javax.xml.transform.dom.DOMSource
 import javax.xml.transform.sax.SAXResult;
 import javax.xml.transform.sax.TransformerHandler;
 
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-
+import org.apache.fop.DebugHelper;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.Fop;
 import org.apache.fop.apps.FopFactory;
@@ -57,41 +53,74 @@ import org.apache.fop.render.intermediat
 import org.apache.fop.render.xml.XMLRenderer;
 import org.apache.fop.util.ConsoleEventListenerForTests;
 import org.apache.fop.util.DelegatingContentHandler;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
 
 /**
  * Class for testing the FOP's layout engine using testcases specified in XML
  * files.
  */
+@RunWith(Parameterized.class)
 public class LayoutEngineTester {
+    private static File areaTreeBackupDir;
+    /**
+     * Sets up the class, this is invoked only once.
+     */
+    @BeforeClass
+    public static void makeDirAndRegisterDebugHelper() {
+        DebugHelper.registerStandardElementListObservers();
+        areaTreeBackupDir = new File("build/test-results/layoutengine");
+        areaTreeBackupDir.mkdirs();
+    }
+
+    /**
+     * Creates the parameters for this test.
+     *
+     * @return the list of file arrays populated with test files
+     * @throws IOException if an I/O error occurs while reading the test file
+     */
+    @Parameters
+    public static Collection<File[]> getParameters() throws IOException {
+        return LayoutEngineTestUtils.getTestFiles();
+    }
 
     private TestAssistant testAssistant = new TestAssistant();
 
     private LayoutEngineChecksFactory layoutEngineChecksFactory = new LayoutEngineChecksFactory();
-    private File areaTreeBackupDir;
+
     private IFTester ifTester;
+    private File testFile;
 
     private TransformerFactory tfactory = TransformerFactory.newInstance();
 
     /**
      * Constructs a new instance.
-     * @param areaTreeBackupDir Optional directory that receives the generated
-     *     area tree XML files. May be null.
+     *
+     * @param testFile the test file
      */
-    public LayoutEngineTester(File areaTreeBackupDir) {
-        this.areaTreeBackupDir = areaTreeBackupDir;
+    public LayoutEngineTester(File testFile) {
         this.ifTester = new IFTester(tfactory, areaTreeBackupDir);
+        this.testFile = testFile;
     }
 
     /**
      * Runs a single layout engine test case.
-     * @param testFile Test case to run
      * @throws TransformerException In case of an XSLT/JAXP problem
      * @throws IOException In case of an I/O problem
      * @throws SAXException In case of a problem during SAX processing
      * @throws ParserConfigurationException In case of a problem with the XML parser setup
      */
-    public void runTest(File testFile)
-            throws TransformerException, SAXException, IOException, ParserConfigurationException {
+    @Test
+    public void runTest() throws TransformerException, SAXException, IOException,
+            ParserConfigurationException {
 
         DOMResult domres = new DOMResult();
 

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/ResultCheck.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/ResultCheck.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/ResultCheck.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/ResultCheck.java Tue Oct  4 10:09:01 2011
@@ -40,9 +40,7 @@ public class ResultCheck implements Layo
         this.property = node.getAttributes().getNamedItem("property").getNodeValue();
     }
 
-    /* (non-Javadoc)
-     * @see LayoutEngineCheck#check(LayoutResult)
-     */
+    /** {@inheritDoc} */
     public void check(LayoutResult result) {
         FormattingResults results = result.getResults();
         String actual;
@@ -59,7 +57,7 @@ public class ResultCheck implements Layo
 
     }
 
-    /** @see java.lang.Object#toString() */
+    @Override
     public String toString() {
         return "Property: " + property;
     }

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/pdf/FileIDGeneratorTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/pdf/FileIDGeneratorTestCase.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/pdf/FileIDGeneratorTestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/pdf/FileIDGeneratorTestCase.java Tue Oct  4 10:09:01 2011
@@ -19,41 +19,57 @@
 
 package org.apache.fop.pdf;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
 
 /**
  * Tests the {@link FileIDGenerator} class.
  */
-public abstract class FileIDGeneratorTestCase extends TestCase {
-
-    /**
-     * Returns a suite containing all the {@link FileIDGenerator} test cases.
-     *
-     * @return the test suite
-     */
-    public static final Test suite() {
-        TestSuite suite = new TestSuite(new Class[] {
-                RandomFileIDGeneratorTestCase.class,
-                DigestFileIDGeneratorTestCase.class },
-                FileIDGeneratorTestCase.class.getName());
-        return suite;
-    }
+@RunWith(Parameterized.class)
+public class FileIDGeneratorTestCase {
 
     /** The generator under test. */
     protected FileIDGenerator fileIDGenerator;
 
+    private TestGetter initializer;
+
+    @Parameters
+    public static Collection<TestGetter[]> getParameters() {
+        ArrayList<TestGetter[]> params = new ArrayList<TestGetter[]>();
+        params.add(new TestGetter[] { new RandomFileIDGeneratorTest() });
+        params.add(new TestGetter[] { new DigestFileIDGeneratorTest() });
+        return params;
+    }
+
+    public FileIDGeneratorTestCase(TestGetter initializer) {
+        this.initializer = initializer;
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        fileIDGenerator = initializer.getSut();
+    }
 
     /** Tests that the getOriginalFileID method generates valid output. */
+    @Test
     public void testOriginal() {
         byte[] fileID = fileIDGenerator.getOriginalFileID();
         fileIDMustBeValid(fileID);
     }
 
     /** Tests that the getUpdatedFileID method generates valid output. */
+    @Test
     public void testUpdated() {
         byte[] fileID = fileIDGenerator.getUpdatedFileID();
         fileIDMustBeValid(fileID);
@@ -65,6 +81,7 @@ public abstract class FileIDGeneratorTes
     }
 
     /** Tests that multiple calls to getOriginalFileID method always return the same value. */
+    @Test
     public void testOriginalMultipleCalls() {
         byte[] fileID1 = fileIDGenerator.getUpdatedFileID();
         byte[] fileID2 = fileIDGenerator.getUpdatedFileID();
@@ -72,20 +89,24 @@ public abstract class FileIDGeneratorTes
     }
 
     /** Tests that getUpdatedFileID returns the same value as getOriginalFileID. */
+    @Test
     public void testUpdateEqualsOriginal() {
         byte[] originalFileID = fileIDGenerator.getOriginalFileID();
         byte[] updatedFileID = fileIDGenerator.getUpdatedFileID();
         assertTrue(Arrays.equals(originalFileID, updatedFileID));
     }
 
+    private static interface TestGetter {
+        FileIDGenerator getSut() throws Exception;
+    }
+
     /**
      * Tests the random file ID generator.
      */
-    public static class RandomFileIDGeneratorTestCase extends FileIDGeneratorTestCase {
+    private static class RandomFileIDGeneratorTest implements TestGetter {
 
-        @Override
-        protected void setUp() throws Exception {
-            fileIDGenerator = FileIDGenerator.getRandomFileIDGenerator();
+        public FileIDGenerator getSut() throws Exception {
+            return FileIDGenerator.getRandomFileIDGenerator();
         }
 
     }
@@ -93,11 +114,10 @@ public abstract class FileIDGeneratorTes
     /**
      * Tests the file ID generator based on an MD5 digest.
      */
-    public static class DigestFileIDGeneratorTestCase extends FileIDGeneratorTestCase {
+    private static class DigestFileIDGeneratorTest implements TestGetter {
 
-        @Override
-        protected void setUp() throws Exception {
-            fileIDGenerator = FileIDGenerator.getDigestFileIDGenerator(
+        public FileIDGenerator getSut() throws Exception {
+            return FileIDGenerator.getDigestFileIDGenerator(
                     new PDFDocument("Apache FOP"));
         }
 

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/pdf/PDFEncryptionJCETestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/pdf/PDFEncryptionJCETestCase.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/pdf/PDFEncryptionJCETestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/pdf/PDFEncryptionJCETestCase.java Tue Oct  4 10:09:01 2011
@@ -19,6 +19,9 @@
 
 package org.apache.fop.pdf;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
@@ -26,12 +29,12 @@ import java.util.Arrays;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
 /**
  * Tests the {@link PDFEncryptionJCE} class.
  */
-public class PDFEncryptionJCETestCase extends TestCase {
+public class PDFEncryptionJCETestCase {
 
     private EncryptionTest test;
 
@@ -271,12 +274,14 @@ public class PDFEncryptionJCETestCase ex
         }
     }
 
+    @Test
     public final void testMake() {
         PDFEncryption testEncryptionObj = createEncryptionObject(new PDFEncryptionParams());
         assertTrue(testEncryptionObj instanceof PDFEncryptionJCE);
         assertEquals(1, ((PDFEncryptionJCE) testEncryptionObj).getObjectNumber());
     }
 
+    @Test
     public void testBasic() throws IOException {
         test = new EncryptionTest();
         test.setData(0x00).setEncryptedData(0x56);
@@ -292,6 +297,7 @@ public class PDFEncryptionJCETestCase ex
         runEncryptionTests();
     }
 
+    @Test
     public void test128bit() throws IOException {
         EncryptionDictionaryTester encryptionDictionaryTester = new EncryptionDictionaryTester()
                 .setVersion(2)
@@ -306,6 +312,7 @@ public class PDFEncryptionJCETestCase ex
         runEncryptionTests();
     }
 
+    @Test
     public void testDisableRev2Permissions() throws IOException {
         EncryptionDictionaryTester encryptionDictionaryTester = new EncryptionDictionaryTester()
                 .setPermissions(-64)
@@ -320,6 +327,7 @@ public class PDFEncryptionJCETestCase ex
         runEncryptionTests();
     }
 
+    @Test
     public void testDisableRev3Permissions() throws IOException {
         EncryptionDictionaryTester encryptionDictionaryTester = new EncryptionDictionaryTester()
                 .setVersion(2)
@@ -337,6 +345,7 @@ public class PDFEncryptionJCETestCase ex
         runEncryptionTests();
     }
 
+    @Test
     public void test128bitDisableSomePermissions() throws IOException {
         EncryptionDictionaryTester encryptionDictionaryTester = new EncryptionDictionaryTester()
                 .setVersion(2)
@@ -355,6 +364,7 @@ public class PDFEncryptionJCETestCase ex
         runEncryptionTests();
     }
 
+    @Test
     public void testDifferentPasswords() throws IOException {
         EncryptionDictionaryTester encryptionDictionaryTester = new EncryptionDictionaryTester()
                 .setOwnerEntry("D11C233C65E9DC872E858ABBD8B62198771167ADCE7AB8DC7AE0A1A7E21A1E25")
@@ -367,6 +377,7 @@ public class PDFEncryptionJCETestCase ex
         runEncryptionTests();
     }
 
+    @Test
     public void testNoOwnerPassword() throws IOException {
         EncryptionDictionaryTester encryptionDictionaryTester = new EncryptionDictionaryTester()
                 .setOwnerEntry("5163AAF3EE74C76D7C223593A84C8702FEA8AA4493E4933FF5B5A5BBB20AE4BB")
@@ -379,6 +390,7 @@ public class PDFEncryptionJCETestCase ex
         runEncryptionTests();
     }
 
+    @Test
     public void test128bitDisableSomePermissionsDifferentPasswords() throws IOException {
         EncryptionDictionaryTester encryptionDictionaryTester = new EncryptionDictionaryTester()
                 .setVersion(2)
@@ -399,6 +411,7 @@ public class PDFEncryptionJCETestCase ex
         runEncryptionTests();
     }
 
+    @Test
     public void test128bitNoPermissionNoOwnerPassword() throws IOException {
         EncryptionDictionaryTester encryptionDictionaryTester = new EncryptionDictionaryTester()
                 .setVersion(2)

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/pdf/PDFFactoryTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/pdf/PDFFactoryTestCase.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/pdf/PDFFactoryTestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/pdf/PDFFactoryTestCase.java Tue Oct  4 10:09:01 2011
@@ -19,20 +19,22 @@
 
 package org.apache.fop.pdf;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
 
 import org.apache.fop.fonts.CIDSubset;
 import org.apache.fop.fonts.MultiByteFont;
+import org.junit.Test;
 
 /**
  * Test case for {@link PDFFactory}.
  */
-public class PDFFactoryTestCase extends TestCase {
+public class PDFFactoryTestCase {
 
     /**
      * This tests that when a font is subset embedded in a PDF, the font name is prefixed with a
      * pseudo-random tag as per the PDF spec.
      */
+    @Test
     public void testSubsetFontNamePrefix() {
         class MockedFont extends MultiByteFont {
             @Override

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/pdf/PDFObjectTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/pdf/PDFObjectTestCase.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/pdf/PDFObjectTestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/pdf/PDFObjectTestCase.java Tue Oct  4 10:09:01 2011
@@ -19,22 +19,25 @@
 
 package org.apache.fop.pdf;
 
+import static org.junit.Assert.assertEquals;
+
 import java.util.Calendar;
 import java.util.Date;
 import java.util.Locale;
 import java.util.TimeZone;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
 /**
  * Tests the PDFObject class.
  */
-public class PDFObjectTestCase extends TestCase {
+public class PDFObjectTestCase {
 
     /**
      * Tests date/time formatting in PDFObject.
      * @throws Exception if an error occurs
      */
+    @Test
     public void testDateFormatting() throws Exception {
         Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"), Locale.ENGLISH);
         cal.set(2008, Calendar.FEBRUARY, 07, 15, 11, 07);
@@ -60,6 +63,7 @@ public class PDFObjectTestCase extends T
      * Tests PDF object references.
      * @throws Exception if an error occurs
      */
+    @Test
     public void testReference() throws Exception {
         PDFDictionary dict = new PDFDictionary();
         dict.setObjectNumber(7);

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/render/AbstractRenderingTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/render/AbstractRenderingTestCase.java?rev=1178747&r1=1178746&r2=1178747&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/render/AbstractRenderingTestCase.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/render/AbstractRenderingTestCase.java Tue Oct  4 10:09:01 2011
@@ -31,11 +31,8 @@ import javax.xml.transform.TransformerFa
 import javax.xml.transform.sax.SAXResult;
 import javax.xml.transform.stream.StreamSource;
 
-import junit.framework.TestCase;
-
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
-
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.Fop;
 import org.apache.fop.apps.FopFactory;
@@ -44,7 +41,7 @@ import org.apache.fop.apps.MimeConstants
 /**
  * Abstract base class for rendering (output) verification tests.
  */
-public abstract class AbstractRenderingTestCase extends TestCase {
+public abstract class AbstractRenderingTestCase {
 
     private static final Map<String, String> MIME_MAP = new java.util.HashMap<String, String>();
 



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org