diff options
Diffstat (limited to 'test/java/org/apache')
202 files changed, 972 insertions, 755 deletions
diff --git a/test/java/org/apache/fop/AbstractBasicTranscoderTest.java b/test/java/org/apache/fop/AbstractBasicTranscoderTest.java index 2087c8df2..7a40b353a 100644 --- a/test/java/org/apache/fop/AbstractBasicTranscoderTest.java +++ b/test/java/org/apache/fop/AbstractBasicTranscoderTest.java @@ -24,13 +24,15 @@ import java.io.InputStream; import org.junit.Test; +import static org.junit.Assert.assertTrue; + +import org.apache.commons.io.output.ByteArrayOutputStream; + import org.apache.batik.transcoder.Transcoder; import org.apache.batik.transcoder.TranscoderInput; import org.apache.batik.transcoder.TranscoderOutput; -import org.apache.commons.io.output.ByteArrayOutputStream; import static org.apache.fop.FOPTestUtils.getBaseDir; -import static org.junit.Assert.assertTrue; /** * Basic runtime test for FOP's transcoders. It is used to verify that diff --git a/test/java/org/apache/fop/BasicDriverTestCase.java b/test/java/org/apache/fop/BasicDriverTestCase.java index f149b451e..e89a1c558 100644 --- a/test/java/org/apache/fop/BasicDriverTestCase.java +++ b/test/java/org/apache/fop/BasicDriverTestCase.java @@ -28,11 +28,13 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.stream.StreamSource; -import org.apache.fop.apps.FOPException; import org.junit.Test; +import static org.junit.Assert.assertTrue; + import org.apache.commons.io.output.ByteArrayOutputStream; +import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.Fop; import org.apache.fop.apps.FopFactory; @@ -40,7 +42,6 @@ import org.apache.fop.apps.MimeConstants; import org.apache.fop.cli.InputHandler; import static org.apache.fop.FOPTestUtils.getBaseDir; -import static org.junit.Assert.assertTrue; /** * Basic runtime test for the old Fop class. It is used to verify that @@ -136,7 +137,7 @@ public class BasicDriverTestCase { InputHandler handler = new InputHandler(xmlFile, xsltFile, null); try { handler.renderTo(foUserAgent, MimeConstants.MIME_PDF, baout); - } catch (FOPException e) {} + } catch (FOPException e) { /* NOP */ } } } diff --git a/test/java/org/apache/fop/BasicDriverTestSuite.java b/test/java/org/apache/fop/BasicDriverTestSuite.java index 8330a5f7f..68619926a 100644 --- a/test/java/org/apache/fop/BasicDriverTestSuite.java +++ b/test/java/org/apache/fop/BasicDriverTestSuite.java @@ -27,6 +27,6 @@ import org.junit.runners.Suite.SuiteClasses; * Test suite for basic functionality of FOP's Driver API. */ @RunWith(Suite.class) -@SuiteClasses({ BasicDriverTestCase.class }) +@SuiteClasses(BasicDriverTestCase.class) public class BasicDriverTestSuite { } diff --git a/test/java/org/apache/fop/BasicPSTranscoderTestCase.java b/test/java/org/apache/fop/BasicPSTranscoderTestCase.java index f2f233a5a..2d6fc0d81 100644 --- a/test/java/org/apache/fop/BasicPSTranscoderTestCase.java +++ b/test/java/org/apache/fop/BasicPSTranscoderTestCase.java @@ -20,6 +20,7 @@ package org.apache.fop; import org.apache.batik.transcoder.Transcoder; + import org.apache.fop.render.ps.PSTranscoder; /** diff --git a/test/java/org/apache/fop/DebugHelper.java b/test/java/org/apache/fop/DebugHelper.java index 6705d2f56..9ee7de072 100644 --- a/test/java/org/apache/fop/DebugHelper.java +++ b/test/java/org/apache/fop/DebugHelper.java @@ -25,7 +25,10 @@ import org.apache.fop.logging.LoggingElementListObserver; /** * Handles some standard tasks for debugging. */ -public class DebugHelper { +public final class DebugHelper { + + private DebugHelper() { + } private static boolean elObserversRegistered = false; diff --git a/test/java/org/apache/fop/DigestFilterTestCase.java b/test/java/org/apache/fop/DigestFilterTestCase.java index 5606c2b66..679b65aee 100644 --- a/test/java/org/apache/fop/DigestFilterTestCase.java +++ b/test/java/org/apache/fop/DigestFilterTestCase.java @@ -19,8 +19,6 @@ package org.apache.fop; -import static org.junit.Assert.assertTrue; - import java.io.IOException; import java.io.StringReader; import java.security.NoSuchAlgorithmException; @@ -28,13 +26,16 @@ import java.security.NoSuchAlgorithmException; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParserFactory; -import org.apache.fop.util.DigestFilter; import org.junit.Before; import org.junit.Test; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; +import static org.junit.Assert.assertTrue; + +import org.apache.fop.util.DigestFilter; + /** * Test case for digesting SAX filter. * diff --git a/test/java/org/apache/fop/KnuthAlgorithmTestCase.java b/test/java/org/apache/fop/KnuthAlgorithmTestCase.java index 18176117c..8f44864e0 100644 --- a/test/java/org/apache/fop/KnuthAlgorithmTestCase.java +++ b/test/java/org/apache/fop/KnuthAlgorithmTestCase.java @@ -19,10 +19,13 @@ package org.apache.fop; -import static org.junit.Assert.assertEquals; - import java.util.List; +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + import org.apache.fop.layoutmgr.BlockKnuthSequence; import org.apache.fop.layoutmgr.BreakingAlgorithm; import org.apache.fop.layoutmgr.ElementListObserver; @@ -30,8 +33,6 @@ import org.apache.fop.layoutmgr.KnuthBox; import org.apache.fop.layoutmgr.KnuthGlue; import org.apache.fop.layoutmgr.KnuthPenalty; import org.apache.fop.layoutmgr.KnuthSequence; -import org.junit.Before; -import org.junit.Test; /** * Tests the Knuth algorithm implementation. diff --git a/test/java/org/apache/fop/URIResolutionTestCase.java b/test/java/org/apache/fop/URIResolutionTestCase.java index e1015306e..e01271f2b 100644 --- a/test/java/org/apache/fop/URIResolutionTestCase.java +++ b/test/java/org/apache/fop/URIResolutionTestCase.java @@ -41,6 +41,9 @@ import org.junit.BeforeClass; import org.junit.Test; import org.w3c.dom.Document; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.apache.commons.io.IOUtils; import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.xpath.XPathAPI; @@ -59,8 +62,6 @@ import org.apache.fop.apps.io.ResourceResolverFactory; import org.apache.fop.render.xml.XMLRenderer; import static org.apache.fop.FOPTestUtils.getBaseDir; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; /** * Tests URI resolution facilities. diff --git a/test/java/org/apache/fop/afp/AFPObjectAreaInfoTestCase.java b/test/java/org/apache/fop/afp/AFPObjectAreaInfoTestCase.java index fc5f1825c..e9134a90b 100644 --- a/test/java/org/apache/fop/afp/AFPObjectAreaInfoTestCase.java +++ b/test/java/org/apache/fop/afp/AFPObjectAreaInfoTestCase.java @@ -19,11 +19,11 @@ package org.apache.fop.afp; -import static org.junit.Assert.assertEquals; - import org.junit.Before; import org.junit.Test; +import static org.junit.Assert.assertEquals; + /** * Test case for {@link AFPObjectAreaInfo}. */ diff --git a/test/java/org/apache/fop/afp/AFPPaintingStateTestCase.java b/test/java/org/apache/fop/afp/AFPPaintingStateTestCase.java index 47c93064c..e9806f944 100644 --- a/test/java/org/apache/fop/afp/AFPPaintingStateTestCase.java +++ b/test/java/org/apache/fop/afp/AFPPaintingStateTestCase.java @@ -19,11 +19,11 @@ package org.apache.fop.afp; -import static org.junit.Assert.assertEquals; - import org.junit.Before; import org.junit.Test; +import static org.junit.Assert.assertEquals; + /** * Test case for {@link AFPPaintingState}. */ diff --git a/test/java/org/apache/fop/afp/AFPResourceManagerTestCase.java b/test/java/org/apache/fop/afp/AFPResourceManagerTestCase.java index 21540221f..9d805a7da 100644 --- a/test/java/org/apache/fop/afp/AFPResourceManagerTestCase.java +++ b/test/java/org/apache/fop/afp/AFPResourceManagerTestCase.java @@ -26,13 +26,13 @@ import java.io.IOException; import org.junit.Before; import org.junit.Test; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.xmlgraphics.util.MimeConstants; import org.apache.fop.apps.io.ResourceResolverFactory; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - /** * Test case for {@link AFPResourceManager}. */ diff --git a/test/java/org/apache/fop/afp/AFPResourceUtilTestCase.java b/test/java/org/apache/fop/afp/AFPResourceUtilTestCase.java index a7cf57ebe..178e5c6ad 100644 --- a/test/java/org/apache/fop/afp/AFPResourceUtilTestCase.java +++ b/test/java/org/apache/fop/afp/AFPResourceUtilTestCase.java @@ -19,8 +19,6 @@ package org.apache.fop.afp; -import static org.junit.Assert.assertTrue; - import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; @@ -29,11 +27,11 @@ import java.util.Arrays; import org.junit.Test; +import static org.junit.Assert.assertTrue; + import org.apache.commons.io.IOUtils; -import org.apache.fop.afp.util.AFPResourceUtil; -import org.junit.Test; -import static org.junit.Assert.assertTrue; +import org.apache.fop.afp.util.AFPResourceUtil; /** * Tests the {@link AFPResourceUtil} class. @@ -133,7 +131,7 @@ public class AFPResourceUtilTestCase { * names fails. * @throws Exception - */ - @Test(expected=Exception.class) + @Test(expected = Exception.class) public void testResourceNameMismatch() throws Exception { testResource(RESOURCE_NAME_MISMATCH, PSEG_B); } @@ -156,6 +154,6 @@ public class AFPResourceUtilTestCase { } private interface ResourceCopier { - public void copy(InputStream in, OutputStream out) throws IOException; + void copy(InputStream in, OutputStream out) throws IOException; } } diff --git a/test/java/org/apache/fop/afp/goca/GraphicsCharacterStringTestCase.java b/test/java/org/apache/fop/afp/goca/GraphicsCharacterStringTestCase.java index b77ef6e12..17c47743c 100644 --- a/test/java/org/apache/fop/afp/goca/GraphicsCharacterStringTestCase.java +++ b/test/java/org/apache/fop/afp/goca/GraphicsCharacterStringTestCase.java @@ -16,16 +16,17 @@ */ package org.apache.fop.afp.goca; -import static org.junit.Assert.assertEquals; - import java.io.ByteArrayOutputStream; import java.io.IOException; +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + import org.apache.fop.afp.fonts.CharacterSet; import org.apache.fop.afp.fonts.CharacterSetBuilder; import org.apache.fop.fonts.Typeface; -import org.junit.Before; -import org.junit.Test; public class GraphicsCharacterStringTestCase { private GraphicsCharacterString gcsCp500; diff --git a/test/java/org/apache/fop/afp/modca/AbstractAFPObjectTest.java b/test/java/org/apache/fop/afp/modca/AbstractAFPObjectTest.java index 65c0224c2..a4c80cc65 100644 --- a/test/java/org/apache/fop/afp/modca/AbstractAFPObjectTest.java +++ b/test/java/org/apache/fop/afp/modca/AbstractAFPObjectTest.java @@ -19,10 +19,6 @@ package org.apache.fop.afp.modca; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; @@ -30,9 +26,14 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.apache.fop.afp.Streamable; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.apache.fop.afp.Streamable; + /** * Tests the {@link AbstractAFPObject} class. */ diff --git a/test/java/org/apache/fop/afp/modca/AbstractNamedAFPObjectTest.java b/test/java/org/apache/fop/afp/modca/AbstractNamedAFPObjectTest.java index 5c863b6e4..0593ae637 100644 --- a/test/java/org/apache/fop/afp/modca/AbstractNamedAFPObjectTest.java +++ b/test/java/org/apache/fop/afp/modca/AbstractNamedAFPObjectTest.java @@ -19,12 +19,12 @@ package org.apache.fop.afp.modca; -import static org.junit.Assert.assertTrue; - import java.util.Arrays; import org.junit.Test; +import static org.junit.Assert.assertTrue; + /** * Tests the {@linkplain AbstractAFPObject} class. */ diff --git a/test/java/org/apache/fop/afp/modca/AbstractStructuredObjectTest.java b/test/java/org/apache/fop/afp/modca/AbstractStructuredObjectTest.java index faef0a4f6..d0a543087 100644 --- a/test/java/org/apache/fop/afp/modca/AbstractStructuredObjectTest.java +++ b/test/java/org/apache/fop/afp/modca/AbstractStructuredObjectTest.java @@ -21,7 +21,8 @@ package org.apache.fop.afp.modca; import java.io.IOException; -public abstract class AbstractStructuredObjectTest<S extends AbstractStructuredObject> extends AbstractAFPObjectTest<S> { +public abstract class AbstractStructuredObjectTest<S extends AbstractStructuredObject> + extends AbstractAFPObjectTest<S> { /** * Test writeStart() - test that the contract is maintained with diff --git a/test/java/org/apache/fop/afp/modca/AbstractTripletStructuredObjectTest.java b/test/java/org/apache/fop/afp/modca/AbstractTripletStructuredObjectTest.java index 10c154550..fe25996bb 100644 --- a/test/java/org/apache/fop/afp/modca/AbstractTripletStructuredObjectTest.java +++ b/test/java/org/apache/fop/afp/modca/AbstractTripletStructuredObjectTest.java @@ -19,10 +19,6 @@ package org.apache.fop.afp.modca; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.ArrayList; @@ -33,6 +29,10 @@ import java.util.List; import org.junit.Before; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.fop.afp.modca.triplets.AbstractTriplet; import org.apache.fop.afp.modca.triplets.AttributeQualifierTriplet; import org.apache.fop.afp.modca.triplets.CommentTriplet; diff --git a/test/java/org/apache/fop/afp/modca/IncludeObjectTestCase.java b/test/java/org/apache/fop/afp/modca/IncludeObjectTestCase.java index 0449f2599..7e096f98b 100644 --- a/test/java/org/apache/fop/afp/modca/IncludeObjectTestCase.java +++ b/test/java/org/apache/fop/afp/modca/IncludeObjectTestCase.java @@ -19,16 +19,17 @@ package org.apache.fop.afp.modca; -import static org.junit.Assert.assertTrue; - import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; -import org.apache.fop.afp.util.BinaryUtils; import org.junit.Before; import org.junit.Test; +import static org.junit.Assert.assertTrue; + +import org.apache.fop.afp.util.BinaryUtils; + /** * Test {@link IncludeObject} */ diff --git a/test/java/org/apache/fop/afp/parser/MODCAParserTestCase.java b/test/java/org/apache/fop/afp/parser/MODCAParserTestCase.java index c80ef086c..176344618 100644 --- a/test/java/org/apache/fop/afp/parser/MODCAParserTestCase.java +++ b/test/java/org/apache/fop/afp/parser/MODCAParserTestCase.java @@ -19,11 +19,6 @@ package org.apache.fop.afp.parser; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.EOFException; @@ -32,6 +27,11 @@ import java.util.Arrays; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + /** * MODCAParser and MODCAParser.UnparsedStructuredField Unit tests */ diff --git a/test/java/org/apache/fop/afp/ptoca/TransparentDataControlSequenceTestCase.java b/test/java/org/apache/fop/afp/ptoca/TransparentDataControlSequenceTestCase.java index 338c5e6f4..8d6c79d05 100644 --- a/test/java/org/apache/fop/afp/ptoca/TransparentDataControlSequenceTestCase.java +++ b/test/java/org/apache/fop/afp/ptoca/TransparentDataControlSequenceTestCase.java @@ -24,15 +24,16 @@ import java.io.OutputStream; import org.junit.Test; -import org.apache.fop.afp.fonts.CharactersetEncoder.EncodedChars; -import org.apache.fop.afp.ptoca.TransparentDataControlSequence.TransparentData; - -import static org.apache.fop.afp.ptoca.PtocaConstants.TRANSPARENT_DATA_MAX_SIZE; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import org.apache.fop.afp.fonts.CharactersetEncoder.EncodedChars; +import org.apache.fop.afp.ptoca.TransparentDataControlSequence.TransparentData; + +import static org.apache.fop.afp.ptoca.PtocaConstants.TRANSPARENT_DATA_MAX_SIZE; + public class TransparentDataControlSequenceTestCase { private EncodedChars encodedChars; diff --git a/test/java/org/apache/fop/apps/AbstractRendererConfigParserTester.java b/test/java/org/apache/fop/apps/AbstractRendererConfigParserTester.java index 9739db2f3..e4c9ceb44 100644 --- a/test/java/org/apache/fop/apps/AbstractRendererConfigParserTester.java +++ b/test/java/org/apache/fop/apps/AbstractRendererConfigParserTester.java @@ -19,6 +19,9 @@ package org.apache.fop.apps; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder; @@ -28,9 +31,6 @@ import org.apache.fop.fonts.FontManager; import org.apache.fop.render.RendererConfig; import org.apache.fop.render.RendererConfig.RendererConfigParser; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public abstract class AbstractRendererConfigParserTester<B extends RendererConfBuilder, C extends RendererConfig> { diff --git a/test/java/org/apache/fop/apps/AbstractRendererConfiguratorTest.java b/test/java/org/apache/fop/apps/AbstractRendererConfiguratorTest.java index 58c14f5df..2487c0a63 100644 --- a/test/java/org/apache/fop/apps/AbstractRendererConfiguratorTest.java +++ b/test/java/org/apache/fop/apps/AbstractRendererConfiguratorTest.java @@ -24,16 +24,17 @@ import java.io.IOException; import org.xml.sax.SAXException; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder; import org.apache.fop.render.PrintRendererConfigurator; import org.apache.fop.render.intermediate.IFDocumentHandler; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public abstract class AbstractRendererConfiguratorTest<T extends PrintRendererConfigurator, B extends RendererConfBuilder> { +public abstract class AbstractRendererConfiguratorTest<T extends PrintRendererConfigurator, + B extends RendererConfBuilder> { protected final String mimeType; protected FOUserAgent userAgent; diff --git a/test/java/org/apache/fop/apps/EnvironmentalProfileFactoryTestCase.java b/test/java/org/apache/fop/apps/EnvironmentalProfileFactoryTestCase.java index e94403e71..83bfd2076 100644 --- a/test/java/org/apache/fop/apps/EnvironmentalProfileFactoryTestCase.java +++ b/test/java/org/apache/fop/apps/EnvironmentalProfileFactoryTestCase.java @@ -21,7 +21,6 @@ import java.net.URI; import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; diff --git a/test/java/org/apache/fop/apps/FopConfParserTestCase.java b/test/java/org/apache/fop/apps/FopConfParserTestCase.java index 3c2930942..dc794fdb8 100644 --- a/test/java/org/apache/fop/apps/FopConfParserTestCase.java +++ b/test/java/org/apache/fop/apps/FopConfParserTestCase.java @@ -19,6 +19,7 @@ package org.apache.fop.apps; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.URI; @@ -127,4 +128,41 @@ public class FopConfParserTestCase { builder.setPreferRenderer(true); assertTrue(buildFactory().getRendererFactory().isRendererPreferred()); } + + @Test + public void testRelativeURINoBaseNoFont() throws Exception { + checkRelativeURIs("test/config/relative-uri/no-base_no-font.xconf", + "", ""); + } + + @Test + public void testRelativeURINoBaseFont() throws Exception { + checkRelativeURIs("test/config/relative-uri/no-base_font.xconf", + "", "test/config/relative-uri/fonts/"); + } + + @Test + public void testRelativeURIBaseNoFont() throws Exception { + checkRelativeURIs("test/config/relative-uri/base_no-font.xconf", + "test/config/relative-uri/relative/", "test/config/relative-uri/relative/"); + } + + @Test + public void testRelativeURIBaseFont() throws Exception { + checkRelativeURIs("test/config/relative-uri/base_font.xconf", + "test/config/relative-uri/relative/", "test/config/relative-uri/fonts/"); + } + + private void checkRelativeURIs(String conf, String expectedBase, String expectedFontBase) + throws SAXException, IOException { + File configFile = new File(conf); + URI currentDir = new File(".").getCanonicalFile().toURI(); + FopConfParser parser = new FopConfParser(configFile, currentDir); + FopFactoryBuilder fopFactoryBuilder = parser.getFopFactoryBuilder(); + assertEquals("base URI", currentDir.resolve(expectedBase), + fopFactoryBuilder.getBaseURI()); + assertEquals("font base", currentDir.resolve(expectedFontBase), + fopFactoryBuilder.getFontManager().getResourceResolver().getBaseURI()); + } + } diff --git a/test/java/org/apache/fop/apps/FopFactoryBuilderTestCase.java b/test/java/org/apache/fop/apps/FopFactoryBuilderTestCase.java index e504c4bc4..86b4e7c04 100644 --- a/test/java/org/apache/fop/apps/FopFactoryBuilderTestCase.java +++ b/test/java/org/apache/fop/apps/FopFactoryBuilderTestCase.java @@ -27,6 +27,12 @@ import java.util.List; import org.junit.Before; import org.junit.Test; +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 static org.junit.Assert.fail; + import org.apache.fop.apps.io.ResourceResolverFactory; import org.apache.fop.area.AreaTreeHandler; import org.apache.fop.area.Block; @@ -45,12 +51,6 @@ import org.apache.fop.layoutmgr.PageSequenceLayoutManager; import org.apache.fop.layoutmgr.StaticContentLayoutManager; import org.apache.fop.layoutmgr.inline.ContentLayoutManager; -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 static org.junit.Assert.fail; - /** * Test case for {@link FopFactoryBuilder}. */ diff --git a/test/java/org/apache/fop/apps/FopFactoryTestCase.java b/test/java/org/apache/fop/apps/FopFactoryTestCase.java index 8ac21c994..439ffa44e 100644 --- a/test/java/org/apache/fop/apps/FopFactoryTestCase.java +++ b/test/java/org/apache/fop/apps/FopFactoryTestCase.java @@ -24,16 +24,15 @@ import java.io.IOException; import org.junit.Test; import org.xml.sax.SAXException; -import org.apache.fop.apps.MimeConstants; -import org.apache.fop.config.BaseConstructiveUserConfigTest; -import org.apache.fop.render.RendererConfig.RendererConfigParser; -import org.apache.fop.render.pdf.PDFRendererConfig; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import org.apache.fop.config.BaseConstructiveUserConfigTest; +import org.apache.fop.render.RendererConfig.RendererConfigParser; +import org.apache.fop.render.pdf.PDFRendererConfig; + public class FopFactoryTestCase extends BaseConstructiveUserConfigTest { public FopFactoryTestCase() throws SAXException, IOException { diff --git a/test/java/org/apache/fop/apps/PDFRendererConfBuilder.java b/test/java/org/apache/fop/apps/PDFRendererConfBuilder.java index 13ca3df6b..3da4e1daf 100644 --- a/test/java/org/apache/fop/apps/PDFRendererConfBuilder.java +++ b/test/java/org/apache/fop/apps/PDFRendererConfBuilder.java @@ -22,10 +22,8 @@ package org.apache.fop.apps; import org.w3c.dom.Element; import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder; -import org.apache.fop.pdf.PDFEncryptionParams; import org.apache.fop.render.RendererConfigOption; import org.apache.fop.render.pdf.PDFEncryptionOption; -import org.apache.fop.render.pdf.PDFRendererOption; import static org.apache.fop.render.pdf.PDFEncryptionOption.ENCRYPTION_LENGTH; import static org.apache.fop.render.pdf.PDFEncryptionOption.ENCRYPTION_PARAMS; diff --git a/test/java/org/apache/fop/apps/io/BaseURIResolutionTest.java b/test/java/org/apache/fop/apps/io/BaseURIResolutionTest.java index 2131407c1..e04283718 100644 --- a/test/java/org/apache/fop/apps/io/BaseURIResolutionTest.java +++ b/test/java/org/apache/fop/apps/io/BaseURIResolutionTest.java @@ -34,6 +34,8 @@ import javax.xml.transform.stream.StreamSource; import org.xml.sax.SAXException; +import static org.junit.Assert.assertTrue; + import org.apache.commons.io.IOUtils; import org.apache.commons.io.output.ByteArrayOutputStream; @@ -48,7 +50,6 @@ import org.apache.fop.apps.FopFactoryBuilder; import org.apache.fop.apps.MimeConstants; import static org.apache.fop.FOPTestUtils.getBaseDir; -import static org.junit.Assert.assertTrue; public abstract class BaseURIResolutionTest { diff --git a/test/java/org/apache/fop/apps/io/FontURIResolver.java b/test/java/org/apache/fop/apps/io/FontURIResolver.java index 40d6c7402..781aca368 100644 --- a/test/java/org/apache/fop/apps/io/FontURIResolver.java +++ b/test/java/org/apache/fop/apps/io/FontURIResolver.java @@ -33,14 +33,13 @@ import javax.xml.transform.TransformerException; import org.junit.Test; import org.xml.sax.SAXException; -import org.apache.fop.apps.FopConfBuilder; -import org.apache.fop.apps.MimeConstants; -import org.apache.fop.apps.PDFRendererConfBuilder; - import static org.junit.Assert.assertTrue; import org.apache.xmlgraphics.io.Resource; +import org.apache.fop.apps.FopConfBuilder; +import org.apache.fop.apps.PDFRendererConfBuilder; + public class FontURIResolver extends BaseURIResolutionTest { public enum Event { diff --git a/test/java/org/apache/fop/area/ViewportTest.java b/test/java/org/apache/fop/area/ViewportTest.java index cb2282071..46412c83d 100644 --- a/test/java/org/apache/fop/area/ViewportTest.java +++ b/test/java/org/apache/fop/area/ViewportTest.java @@ -19,13 +19,13 @@ package org.apache.fop.area; +import java.awt.Rectangle; + 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.awt.Rectangle; - /** * Tests implementations of the {@linkplain Viewport} interface. */ diff --git a/test/java/org/apache/fop/area/ViewportTestSuite.java b/test/java/org/apache/fop/area/ViewportTestSuite.java index 065e07bf9..891f1d081 100644 --- a/test/java/org/apache/fop/area/ViewportTestSuite.java +++ b/test/java/org/apache/fop/area/ViewportTestSuite.java @@ -19,11 +19,12 @@ package org.apache.fop.area; -import org.apache.fop.area.inline.InlineViewportTestCase; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; +import org.apache.fop.area.inline.InlineViewportTestCase; + /** * A suite of all the tests relating to the {@linkplain Viewport} interface. */ diff --git a/test/java/org/apache/fop/area/inline/InlineViewportTestCase.java b/test/java/org/apache/fop/area/inline/InlineViewportTestCase.java index edcf99d14..cba5759cf 100644 --- a/test/java/org/apache/fop/area/inline/InlineViewportTestCase.java +++ b/test/java/org/apache/fop/area/inline/InlineViewportTestCase.java @@ -19,9 +19,10 @@ package org.apache.fop.area.inline; -import org.apache.fop.area.ViewportTest; import org.junit.Test; +import org.apache.fop.area.ViewportTest; + /** * Tests the {@linkplain InlineViewport} class. */ diff --git a/test/java/org/apache/fop/check/ChecksFactory.java b/test/java/org/apache/fop/check/ChecksFactory.java index a493c09f2..d77ce422d 100644 --- a/test/java/org/apache/fop/check/ChecksFactory.java +++ b/test/java/org/apache/fop/check/ChecksFactory.java @@ -37,7 +37,7 @@ public abstract class ChecksFactory<C extends Check> { /** * A factory to create a particular kind of check. */ - protected static interface CheckFactory<C> { + protected interface CheckFactory<C> { /** * Creates a {@link Check} instance from the given XML element. diff --git a/test/java/org/apache/fop/cli/CommandLineOptionsTestCase.java b/test/java/org/apache/fop/cli/CommandLineOptionsTestCase.java index 9a80fd964..1be3daa84 100644 --- a/test/java/org/apache/fop/cli/CommandLineOptionsTestCase.java +++ b/test/java/org/apache/fop/cli/CommandLineOptionsTestCase.java @@ -19,15 +19,16 @@ package org.apache.fop.cli; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import java.io.IOException; -import org.apache.fop.apps.FOPException; import org.junit.Before; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.apache.fop.apps.FOPException; + public class CommandLineOptionsTestCase { private final CommandLineOptions clo = new CommandLineOptions(); diff --git a/test/java/org/apache/fop/complexscripts/bidi/BidiAlgorithmTestCase.java b/test/java/org/apache/fop/complexscripts/bidi/BidiAlgorithmTestCase.java index f20e113c1..8ed1af217 100644 --- a/test/java/org/apache/fop/complexscripts/bidi/BidiAlgorithmTestCase.java +++ b/test/java/org/apache/fop/complexscripts/bidi/BidiAlgorithmTestCase.java @@ -19,26 +19,23 @@ package org.apache.fop.complexscripts.bidi; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.apache.fop.complexscripts.bidi.UnicodeBidiAlgorithm; - import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + /** * <p>Test case for Unicode Bidi Algorithm.</p> - * @author Glenn Adams */ public class BidiAlgorithmTestCase { /** * logging instance */ - private static final Log log = LogFactory.getLog(BidiAlgorithmTestCase.class); // CSOK: ConstantNameCheck + private static final Log log = LogFactory.getLog(BidiAlgorithmTestCase.class); /** * Concatenated array of <test-set,test-sequence> tuples @@ -122,7 +119,7 @@ public class BidiAlgorithmTestCase { } if (includeSequence(testSet, testSequence)) { includedSequences++; - if (! excludeSequence(testSet, testSequence)) { + if (!excludeSequence(testSet, testSequence)) { if (testBidiAlgorithm(testSet, testSequence, la, ra, ta, bs)) { passedSequences++; } @@ -151,7 +148,7 @@ public class BidiAlgorithmTestCase { } private boolean includeSequence(int testSet, int testSequence) { - if (! includeTestSet(testSet)) { + if (!includeTestSet(testSet)) { return false; } else { for (int i = 0, n = INCLUSIONS.length / 2; i < n; i++) { @@ -196,7 +193,8 @@ public class BidiAlgorithmTestCase { return false; } - private boolean testBidiAlgorithm(int testSet, int testSequence, int[] la, int[] ra, int[] ta, int bs) throws Exception { + private boolean testBidiAlgorithm(int testSet, int testSequence, int[] la, int[] ra, int[] ta, int bs) + throws Exception { boolean passed = true; int n = la.length; if (ra.length != n) { @@ -211,14 +209,14 @@ public class BidiAlgorithmTestCase { // LTR if ((bs & 2) != 0) { int[] levels = UnicodeBidiAlgorithm.resolveLevels(null, ta, 0, new int [ n ], true); - if (! verifyResults(la, levels, ta, 0, testSet, testSequence)) { + if (!verifyResults(la, levels, ta, 0, testSet, testSequence)) { passed = false; } } // RTL if ((bs & 4) != 0) { int[] levels = UnicodeBidiAlgorithm.resolveLevels(null, ta, 1, new int [ n ], true); - if (! verifyResults(la, levels, ta, 1, testSet, testSequence)) { + if (!verifyResults(la, levels, ta, 1, testSet, testSequence)) { passed = false; } } diff --git a/test/java/org/apache/fop/complexscripts/bidi/BidiClassTestCase.java b/test/java/org/apache/fop/complexscripts/bidi/BidiClassTestCase.java index 10a84b856..f393e5b70 100644 --- a/test/java/org/apache/fop/complexscripts/bidi/BidiClassTestCase.java +++ b/test/java/org/apache/fop/complexscripts/bidi/BidiClassTestCase.java @@ -19,14 +19,13 @@ package org.apache.fop.complexscripts.bidi; -import org.apache.fop.complexscripts.bidi.BidiClass; -import org.apache.fop.util.CharUtilities; - import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; +import org.apache.fop.util.CharUtilities; + public class BidiClassTestCase { @Test @@ -46,8 +45,8 @@ public class BidiClassTestCase { private void testBidiClass(int[] da) throws Exception { int bc = da[0]; for (int i = 1, n = da.length; i < n; i += 2) { - int s = da[i+0]; - int e = da[i+1]; + int s = da[i + 0]; + int e = da[i + 1]; for (int c = s; c < e; c++) { int cbc = BidiClass.getBidiClass(c); assertEquals("bad bidi class for CH(" + CharUtilities.format(c) + ")", bc, cbc); diff --git a/test/java/org/apache/fop/complexscripts/bidi/BidiTestData.java b/test/java/org/apache/fop/complexscripts/bidi/BidiTestData.java index 726682ce0..49a5c9455 100644 --- a/test/java/org/apache/fop/complexscripts/bidi/BidiTestData.java +++ b/test/java/org/apache/fop/complexscripts/bidi/BidiTestData.java @@ -23,7 +23,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; -// CSOFF: WhitespaceAfterCheck /* * !!! THIS IS A GENERATED FILE !!! @@ -66,7 +65,7 @@ public final class BidiTestData { data = null; } finally { if (is != null) { - try { is.close(); } catch (Exception e) {} + try { is.close(); } catch (Exception e) { /* NOP */ } } } return data; diff --git a/test/java/org/apache/fop/complexscripts/fonts/GDEFTestCase.java b/test/java/org/apache/fop/complexscripts/fonts/GDEFTestCase.java index af929d3a1..f1512903c 100644 --- a/test/java/org/apache/fop/complexscripts/fonts/GDEFTestCase.java +++ b/test/java/org/apache/fop/complexscripts/fonts/GDEFTestCase.java @@ -21,21 +21,14 @@ package org.apache.fop.complexscripts.fonts; import java.io.File; -import org.apache.fop.complexscripts.fonts.GlyphSubtable; -import org.apache.fop.complexscripts.fonts.GlyphDefinitionSubtable; -import org.apache.fop.complexscripts.fonts.GlyphDefinitionTable; -import org.apache.fop.complexscripts.fonts.GlyphTable.LookupSpec; -import org.apache.fop.complexscripts.fonts.GlyphTable.LookupTable; -import org.apache.fop.complexscripts.fonts.ttx.TTXFile; -import org.apache.fop.complexscripts.util.GlyphContextTester; -import org.apache.fop.complexscripts.util.GlyphSequence; - import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import org.apache.fop.complexscripts.fonts.ttx.TTXFile; + public class GDEFTestCase { private static String ttxFilesRoot = "test/resources/complexscripts"; diff --git a/test/java/org/apache/fop/complexscripts/fonts/GPOSTestCase.java b/test/java/org/apache/fop/complexscripts/fonts/GPOSTestCase.java index 270b56797..cf63b4eff 100644 --- a/test/java/org/apache/fop/complexscripts/fonts/GPOSTestCase.java +++ b/test/java/org/apache/fop/complexscripts/fonts/GPOSTestCase.java @@ -20,18 +20,6 @@ package org.apache.fop.complexscripts.fonts; import java.io.File; -import java.util.List; -import java.util.Map; - -import org.apache.fop.complexscripts.fonts.GlyphSubtable; -import org.apache.fop.complexscripts.fonts.GlyphPositioningSubtable; -import org.apache.fop.complexscripts.fonts.GlyphPositioningTable; -import org.apache.fop.complexscripts.fonts.GlyphTable.LookupSpec; -import org.apache.fop.complexscripts.fonts.GlyphTable.LookupTable; -import org.apache.fop.complexscripts.fonts.ttx.TTXFile; -import org.apache.fop.complexscripts.util.GlyphContextTester; -import org.apache.fop.complexscripts.util.GlyphSequence; -import org.apache.fop.complexscripts.util.ScriptContextTester; import org.junit.Test; @@ -40,6 +28,14 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import org.apache.fop.complexscripts.fonts.GlyphTable.LookupTable; +import org.apache.fop.complexscripts.fonts.ttx.TTXFile; +import org.apache.fop.complexscripts.util.GlyphContextTester; +import org.apache.fop.complexscripts.util.GlyphSequence; +import org.apache.fop.complexscripts.util.ScriptContextTester; + +// CSOFF: LineLength + public class GPOSTestCase implements ScriptContextTester, GlyphContextTester { private static String ttxFilesRoot = "test/resources/complexscripts"; diff --git a/test/java/org/apache/fop/complexscripts/fonts/GSUBTestCase.java b/test/java/org/apache/fop/complexscripts/fonts/GSUBTestCase.java index b235fa58c..3f23d9ab3 100644 --- a/test/java/org/apache/fop/complexscripts/fonts/GSUBTestCase.java +++ b/test/java/org/apache/fop/complexscripts/fonts/GSUBTestCase.java @@ -21,18 +21,6 @@ package org.apache.fop.complexscripts.fonts; import java.io.File; import java.nio.IntBuffer; -import java.util.List; -import java.util.Map; - -import org.apache.fop.complexscripts.fonts.GlyphSubtable; -import org.apache.fop.complexscripts.fonts.GlyphSubstitutionSubtable; -import org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable; -import org.apache.fop.complexscripts.fonts.GlyphTable.LookupSpec; -import org.apache.fop.complexscripts.fonts.GlyphTable.LookupTable; -import org.apache.fop.complexscripts.fonts.ttx.TTXFile; -import org.apache.fop.complexscripts.util.GlyphContextTester; -import org.apache.fop.complexscripts.util.GlyphSequence; -import org.apache.fop.complexscripts.util.ScriptContextTester; import org.junit.Test; @@ -41,6 +29,14 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import org.apache.fop.complexscripts.fonts.GlyphTable.LookupTable; +import org.apache.fop.complexscripts.fonts.ttx.TTXFile; +import org.apache.fop.complexscripts.util.GlyphContextTester; +import org.apache.fop.complexscripts.util.GlyphSequence; +import org.apache.fop.complexscripts.util.ScriptContextTester; + +// CSOFF: LineLength + public class GSUBTestCase implements ScriptContextTester, GlyphContextTester { private static String ttxFilesRoot = "test/resources/complexscripts"; diff --git a/test/java/org/apache/fop/complexscripts/fonts/ttx/TTXFile.java b/test/java/org/apache/fop/complexscripts/fonts/ttx/TTXFile.java index b3e080d50..178203ff6 100644 --- a/test/java/org/apache/fop/complexscripts/fonts/ttx/TTXFile.java +++ b/test/java/org/apache/fop/complexscripts/fonts/ttx/TTXFile.java @@ -21,11 +21,9 @@ package org.apache.fop.complexscripts.fonts.ttx; import java.io.File; import java.io.IOException; - import java.nio.IntBuffer; - -import java.util.Arrays; import java.util.ArrayList; +import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.LinkedHashMap; @@ -41,21 +39,23 @@ import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; +import org.xml.sax.Attributes; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.fop.complexscripts.fonts.GlyphClassTable; import org.apache.fop.complexscripts.fonts.GlyphCoverageTable; -import org.apache.fop.complexscripts.fonts.GlyphDefinitionSubtable; import org.apache.fop.complexscripts.fonts.GlyphDefinitionTable; import org.apache.fop.complexscripts.fonts.GlyphMappingTable; -import org.apache.fop.complexscripts.fonts.GlyphPositioningSubtable; import org.apache.fop.complexscripts.fonts.GlyphPositioningTable; import org.apache.fop.complexscripts.fonts.GlyphPositioningTable.Anchor; import org.apache.fop.complexscripts.fonts.GlyphPositioningTable.MarkAnchor; import org.apache.fop.complexscripts.fonts.GlyphPositioningTable.PairValues; import org.apache.fop.complexscripts.fonts.GlyphPositioningTable.Value; -import org.apache.fop.complexscripts.fonts.GlyphSubstitutionSubtable; import org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable; import org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable.Ligature; import org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable.LigatureSet; @@ -66,15 +66,8 @@ import org.apache.fop.complexscripts.util.GlyphSequence; import org.apache.fop.complexscripts.util.UTF32; import org.apache.fop.util.CharUtilities; -import org.xml.sax.Attributes; -import org.xml.sax.Locator; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -// CSOFF: InnerAssignmentCheck // CSOFF: LineLengthCheck -// CSOFF: NoWhitespaceAfterCheck /** * This class supports a subset of the <code>TTX</code> file as produced by the Adobe FLEX @@ -89,8 +82,6 @@ import org.xml.sax.helpers.DefaultHandler; * files directly in the FOP distribution. In such cases, <code>TTX</code> files are used * to distribute a subset of the complex script advanced table information contained in * certain font files to facilitate testing. - * - * @author Glenn Adams */ public class TTXFile { @@ -102,22 +93,22 @@ public class TTXFile { private static final String DEFAULT_LANGUAGE_TAG = "dflt"; /** ttxfile cache */ - private static Map<String,TTXFile> cache = new HashMap<String,TTXFile>(); + private static Map<String, TTXFile> cache = new HashMap<String, TTXFile>(); // transient parsing state private Locator locator; // current document locator private Stack<String[]> elements; // stack of ttx elements being parsed - private Map<String,Integer> glyphIds; // map of glyph names to glyph identifiers + private Map<String, Integer> glyphIds; // map of glyph names to glyph identifiers private List<int[]> cmapEntries; // list of <charCode,glyphCode> pairs private Vector<int[]> hmtxEntries; // vector of <width,lsb> pairs - private Map<String,Integer> glyphClasses; // map of glyph names to glyph classes - private Map<String,Map<String,List<String>>> scripts; // map of script tag to Map<language-tag,List<features-id>>> - private Map<String,List<String>> languages; // map of language tag to List<feature-id> - private Map<String,Object[]> features; // map of feature id to Object[2] : { feature-tag, List<lookup-id> } + private Map<String, Integer> glyphClasses; // map of glyph names to glyph classes + private Map<String, Map<String, List<String>>> scripts; // map of script tag to Map<language-tag,List<features-id>>> + private Map<String, List<String>> languages; // map of language tag to List<feature-id> + private Map<String, Object[]> features; // map of feature id to Object[2] : { feature-tag, List<lookup-id> } private List<String> languageFeatures; // list of language system feature ids, where first is (possibly null) required feature id private List<String> featureLookups; // list of lookup ids for feature being constructed private List<Integer> coverageEntries; // list of entries for coverage table being constructed - private Map<String,GlyphCoverageTable> coverages; // map of coverage table keys to coverage tables + private Map<String, GlyphCoverageTable> coverages; // map of coverage table keys to coverage tables private List subtableEntries; // list of lookup subtable entries private List<GlyphSubtable> subtables; // list of constructed subtables private List<Integer> alternates; // list of alternates in alternate set being constructed @@ -164,8 +155,8 @@ public class TTXFile { // resultant state private int upem; // units per em - private Map<Integer,Integer> cmap; // constructed character map - private Map<Integer,Integer> gmap; // constructed glyph map + private Map<Integer, Integer> cmap; // constructed character map + private Map<Integer, Integer> gmap; // constructed glyph map private int[][] hmtx; // constructed horizontal metrics - array of design { width, lsb } pairs, indexed by glyph code private int[] widths; // pdf normalized widths (millipoints) private GlyphDefinitionTable gdef; // constructed glyph definition table @@ -174,17 +165,17 @@ public class TTXFile { public TTXFile() { elements = new Stack<String[]>(); - glyphIds = new HashMap<String,Integer>(); + glyphIds = new HashMap<String, Integer>(); cmapEntries = new ArrayList<int[]>(); hmtxEntries = new Vector<int[]>(); - glyphClasses = new HashMap<String,Integer>(); - scripts = new HashMap<String,Map<String,List<String>>>(); - languages = new HashMap<String,List<String>>(); - features = new HashMap<String,Object[]>(); + glyphClasses = new HashMap<String, Integer>(); + scripts = new HashMap<String, Map<String, List<String>>>(); + languages = new HashMap<String, List<String>>(); + features = new HashMap<String, Object[]>(); languageFeatures = new ArrayList<String>(); featureLookups = new ArrayList<String>(); coverageEntries = new ArrayList<Integer>(); - coverages = new HashMap<String,GlyphCoverageTable>(); + coverages = new HashMap<String, GlyphCoverageTable>(); subtableEntries = new ArrayList(); subtables = new ArrayList<GlyphSubtable>(); alternates = new ArrayList<Integer>(); @@ -344,7 +335,7 @@ public class TTXFile { long rest1 = tw % upem; long storrest = 1000 * rest1; long ledd2 = (storrest != 0) ? (rest1 / storrest) : 0; - pw = - ((-1000 * tw) / upem - (int) ledd2); + pw = -((-1000 * tw) / upem - (int) ledd2); } else { pw = (tw / upem) * 1000 + ((tw % upem) * 1000) / upem; } @@ -372,7 +363,7 @@ public class TTXFile { public static synchronized void clearCache() { cache.clear(); } - private class Handler extends DefaultHandler { + private final class Handler extends DefaultHandler { private Handler() { } @Override @@ -495,7 +486,7 @@ public class TTXFile { } } else if (en[1].equals("BaseArray")) { String[] pn = new String[] { null, "MarkBasePos" }; - if (! isParent(pn)) { + if (!isParent(pn)) { notPermittedInElementContext(en, getParent(), pn); } } else if (en[1].equals("BaseCoverage")) { @@ -589,7 +580,7 @@ public class TTXFile { if (glyphClass == null) { missingRequiredAttribute(en, "class"); } - if (! glyphIds.containsKey(glyph)) { + if (!glyphIds.containsKey(glyph)) { unsupportedGlyph(en, glyph); } else if (isParent(pn1)) { if (glyphClasses.containsKey(glyph)) { @@ -677,7 +668,7 @@ public class TTXFile { } } else if (en[1].equals("DefaultLangSys")) { String[] pn = new String[] { null, "Script" }; - if (! isParent(pn)) { + if (!isParent(pn)) { notPermittedInElementContext(en, getParent(), pn); } else { assertLanguageFeaturesClear(); @@ -720,7 +711,7 @@ public class TTXFile { } } else if (en[1].equals("Feature")) { String[] pn = new String[] { null, "FeatureRecord" }; - if (! isParent(pn)) { + if (!isParent(pn)) { notPermittedInElementContext(en, getParent(), pn); } else { assertFeatureLookupsClear(); @@ -754,7 +745,7 @@ public class TTXFile { String[] pn1 = new String[] { null, "GSUB" }; String[] pn2 = new String[] { null, "GPOS" }; String[][] pnx = new String[][] { pn1, pn2 }; - if (! isParent(pnx)) { + if (!isParent(pnx)) { notPermittedInElementContext(en, getParent(), pnx); } } else if (en[1].equals("FeatureRecord")) { @@ -887,7 +878,7 @@ public class TTXFile { } } else if (en[1].equals("GlyphOrder")) { String[] pn = new String[] { null, "ttFont" }; - if (! isParent(pn)) { + if (!isParent(pn)) { notPermittedInElementContext(en, getParent(), pn); } } else if (en[1].equals("InputCoverage")) { @@ -925,7 +916,7 @@ public class TTXFile { } } else if (en[1].equals("LangSys")) { String[] pn = new String[] { null, "LangSysRecord" }; - if (! isParent(pn)) { + if (!isParent(pn)) { notPermittedInElementContext(en, getParent(), pn); } else { assertLanguageFeaturesClear(); @@ -955,7 +946,7 @@ public class TTXFile { } } else if (en[1].equals("LigCaretList")) { String[] pn = new String[] { null, "GDEF" }; - if (! isParent(pn)) { + if (!isParent(pn)) { notPermittedInElementContext(en, getParent(), pn); } } else if (en[1].equals("Ligature")) { @@ -993,7 +984,7 @@ public class TTXFile { } } else if (en[1].equals("LigatureArray")) { String[] pn = new String[] { null, "MarkLigPos" }; - if (! isParent(pn)) { + if (!isParent(pn)) { notPermittedInElementContext(en, getParent(), pn); } } else if (en[1].equals("LigatureAttach")) { @@ -1141,7 +1132,7 @@ public class TTXFile { String[] pn1 = new String[] { null, "GSUB" }; String[] pn2 = new String[] { null, "GPOS" }; String[][] pnx = new String[][] { pn1, pn2 }; - if (! isParent(pnx)) { + if (!isParent(pnx)) { notPermittedInElementContext(en, getParent(), pnx); } } else if (en[1].equals("LookupListIndex")) { @@ -1181,7 +1172,7 @@ public class TTXFile { } } else if (en[1].equals("Mark1Array")) { String[] pn = new String[] { null, "MarkMarkPos" }; - if (! isParent(pn)) { + if (!isParent(pn)) { notPermittedInElementContext(en, getParent(), pn); } } else if (en[1].equals("Mark1Coverage")) { @@ -1222,7 +1213,7 @@ public class TTXFile { } } else if (en[1].equals("Mark2Array")) { String[] pn = new String[] { null, "MarkMarkPos" }; - if (! isParent(pn)) { + if (!isParent(pn)) { notPermittedInElementContext(en, getParent(), pn); } } else if (en[1].equals("Mark2Coverage")) { @@ -1275,7 +1266,7 @@ public class TTXFile { String[] pn1 = new String[] { null, "MarkBasePos" }; String[] pn2 = new String[] { null, "MarkLigPos" }; String[][] pnx = new String[][] { pn1, pn2 }; - if (! isParent(pnx)) { + if (!isParent(pnx)) { notPermittedInElementContext(en, getParent(), pnx); } } else if (en[1].equals("MarkAttachClassDef")) { @@ -1551,14 +1542,14 @@ public class TTXFile { } } else if (en[1].equals("Script")) { String[] pn = new String[] { null, "ScriptRecord" }; - if (! isParent(pn)) { + if (!isParent(pn)) { notPermittedInElementContext(en, getParent(), pn); } } else if (en[1].equals("ScriptList")) { String[] pn1 = new String[] { null, "GSUB" }; String[] pn2 = new String[] { null, "GPOS" }; String[][] pnx = new String[][] { pn1, pn2 }; - if (! isParent(pnx)) { + if (!isParent(pnx)) { notPermittedInElementContext(en, getParent(), pnx); } } else if (en[1].equals("ScriptRecord")) { @@ -1892,7 +1883,7 @@ public class TTXFile { } } else if (en[1].equals("cmap")) { String[] pn = new String[] { null, "ttFont" }; - if (! isParent(pn)) { + if (!isParent(pn)) { notPermittedInElementContext(en, getParent(), pn); } } else if (en[1].equals("cmap_format_0")) { @@ -1999,12 +1990,12 @@ public class TTXFile { } } else if (en[1].equals("head")) { String[] pn = new String[] { null, "ttFont" }; - if (! isParent(pn)) { + if (!isParent(pn)) { notPermittedInElementContext(en, getParent(), pn); } } else if (en[1].equals("hmtx")) { String[] pn = new String[] { null, "ttFont" }; - if (! isParent(pn)) { + if (!isParent(pn)) { notPermittedInElementContext(en, getParent(), pn); } else if (glyphIdMax > 0) { hmtxEntries.setSize(glyphIdMax + 1); @@ -2218,7 +2209,7 @@ public class TTXFile { throw new SAXException("element stack is empty, elements are not balanced"); } String[] en = makeExpandedName(uri, localName, qName); - if (! sameExpandedName(enParent, en)) { + if (!sameExpandedName(enParent, en)) { throw new SAXException("element stack is unbalanced, expanded name mismatch"); } if (en[0] != null) { @@ -2246,7 +2237,7 @@ public class TTXFile { } else if (en[1].equals("AlternateSet")) { subtableEntries.add(extractAlternates()); } else if (en[1].equals("AlternateSubst")) { - if (! sortEntries(coverageEntries, subtableEntries)) { + if (!sortEntries(coverageEntries, subtableEntries)) { mismatchedEntries(en, coverageEntries.size(), subtableEntries.size()); } addGSUBSubtable(GlyphSubstitutionTable.GSUB_LOOKUP_TYPE_ALTERNATE, extractCoverage()); @@ -2264,9 +2255,9 @@ public class TTXFile { } else if (en[1].equals("ChainContextPos") || en[1].equals("ChainContextSubst")) { GlyphCoverageTable coverage = null; if (stFormat == 3) { - GlyphCoverageTable igca[] = getCoveragesWithPrefix("in"); - GlyphCoverageTable bgca[] = getCoveragesWithPrefix("bk"); - GlyphCoverageTable lgca[] = getCoveragesWithPrefix("la"); + GlyphCoverageTable[] igca = getCoveragesWithPrefix("in"); + GlyphCoverageTable[] bgca = getCoveragesWithPrefix("bk"); + GlyphCoverageTable[] lgca = getCoveragesWithPrefix("la"); if ((igca.length == 0) || hasMissingCoverage(igca)) { missingCoverage(en, "input", igca.length); } else if (hasMissingCoverage(bgca)) { @@ -2365,7 +2356,7 @@ public class TTXFile { } else if (en[1].equals("LigatureSet")) { subtableEntries.add(extractLigatures()); } else if (en[1].equals("LigatureSubst")) { - if (! sortEntries(coverageEntries, subtableEntries)) { + if (!sortEntries(coverageEntries, subtableEntries)) { mismatchedEntries(en, coverageEntries.size(), subtableEntries.size()); } GlyphCoverageTable coverage = extractCoverage(); @@ -2477,7 +2468,8 @@ public class TTXFile { } GlyphCoverageTable coverage = coverages.get("main"); addGPOSSubtable(GlyphPositioningTable.GPOS_LOOKUP_TYPE_PAIR, coverage); - vf1 = vf2 = -1; psIndex = -1; + vf1 = vf2 = -1; + psIndex = -1; } else if (en[1].equals("PairSet")) { if (psIndex != pairSets.size()) { invalidIndex(en, psIndex, pairSets.size()); @@ -2530,7 +2522,7 @@ public class TTXFile { addGPOSSubtable(GlyphPositioningTable.GPOS_LOOKUP_TYPE_SINGLE, coverage); vf1 = -1; } else if (en[1].equals("SingleSubst")) { - if (! sortEntries(coverageEntries, subtableEntries)) { + if (!sortEntries(coverageEntries, subtableEntries)) { mismatchedEntries(en, coverageEntries.size(), subtableEntries.size()); } GlyphCoverageTable coverage = extractCoverage(); @@ -2558,7 +2550,7 @@ public class TTXFile { public void characters(char[] chars, int start, int length) { } private String[] getParent() { - if (! elements.empty()) { + if (!elements.empty()) { return elements.peek(); } else { return new String[] { null, null }; @@ -2574,13 +2566,11 @@ public class TTXFile { return false; } else if (enx instanceof String[]) { String[] en = (String[]) enx; - if (! elements.empty()) { + if (!elements.empty()) { String[] pn = elements.peek(); return (pn != null) && sameExpandedName(en, pn); - } else if ((en[0] == null) && (en[1] == null)) { - return true; } else { - return false; + return ((en[0] == null) && (en[1] == null)); } } else { return false; @@ -2597,14 +2587,12 @@ public class TTXFile { return true; } else if (ln.equals("MarkAnchor")) { return true; - } else if (ln.equals("Mark2Anchor")) { - return true; } else { - return false; + return ln.equals("Mark2Anchor"); } } - private Map<Integer,Integer> getCMAP() { - Map<Integer,Integer> cmap = new TreeMap(); + private Map<Integer, Integer> getCMAP() { + Map<Integer, Integer> cmap = new TreeMap(); for (int[] cme : cmapEntries) { Integer c = Integer.valueOf(cme[0]); Integer g = Integer.valueOf(cme[1]); @@ -2612,8 +2600,8 @@ public class TTXFile { } return cmap; } - private Map<Integer,Integer> getGMAP() { - Map<Integer,Integer> gmap = new TreeMap(); + private Map<Integer, Integer> getGMAP() { + Map<Integer, Integer> gmap = new TreeMap(); for (int[] cme : cmapEntries) { Integer c = Integer.valueOf(cme[0]); Integer g = Integer.valueOf(cme[1]); @@ -2633,7 +2621,7 @@ public class TTXFile { } return hmtx; } - private GlyphClassTable extractClassDefMapping(Map<String,Integer> glyphClasses, int format, boolean clearSourceMap) { + private GlyphClassTable extractClassDefMapping(Map<String, Integer> glyphClasses, int format, boolean clearSourceMap) { GlyphClassTable ct; if (format == 1) { ct = extractClassDefMapping1(extractClassMappings(glyphClasses, clearSourceMap)); @@ -2687,11 +2675,11 @@ public class TTXFile { } return GlyphClassTable.createClassTable(entries); } - private int[][] extractClassMappings(Map<String,Integer> glyphClasses, boolean clearSourceMap) { + private int[][] extractClassMappings(Map<String, Integer> glyphClasses, boolean clearSourceMap) { int nc = glyphClasses.size(); int i = 0; int[][] cma = new int [ nc ] [ 2 ]; - for (Map.Entry<String,Integer> e : glyphClasses.entrySet()) { + for (Map.Entry<String, Integer> e : glyphClasses.entrySet()) { Integer gid = glyphIds.get(e.getKey()); assert gid != null; int[] m = cma [ i ]; @@ -2858,8 +2846,8 @@ public class TTXFile { private void clearLanguageFeatures() { languageFeatures.clear(); } - private Map<String,List<String>> extractLanguages() { - Map<String,List<String>> lm = new HashMap(languages); + private Map<String, List<String>> extractLanguages() { + Map<String, List<String>> lm = new HashMap(languages); clearLanguages(); return lm; } @@ -2925,10 +2913,10 @@ public class TTXFile { ltFlags = 0; clearSubtablesInLookup(); } - private Map<GlyphTable.LookupSpec,List<String>> extractLookups() { - Map<GlyphTable.LookupSpec,List<String>> lookups = new LinkedHashMap<GlyphTable.LookupSpec,List<String>>(); + private Map<GlyphTable.LookupSpec, List<String>> extractLookups() { + Map<GlyphTable.LookupSpec, List<String>> lookups = new LinkedHashMap<GlyphTable.LookupSpec, List<String>>(); for (String st : scripts.keySet()) { - Map<String,List<String>> lm = scripts.get(st); + Map<String, List<String>> lm = scripts.get(st); if (lm != null) { for (String lt : lm.keySet()) { List<String> fids = lm.get(lt); @@ -3064,7 +3052,7 @@ public class TTXFile { missingParameter(en, "xAdvance"); } String yAdvance = attrs.getValue("YAdvance"); - int ya = 0;; + int ya = 0; if (yAdvance != null) { ya = Integer.parseInt(yAdvance); } else if ((format & GlyphPositioningTable.Value.Y_ADVANCE) != 0) { @@ -3209,7 +3197,7 @@ public class TTXFile { if (cm != null) { for (Anchor[] aa : cm) { if (aa != null) { - int nc = aa.length;; + int nc = aa.length; if (nc > ncMax) { ncMax = nc; } @@ -3225,7 +3213,7 @@ public class TTXFile { if (lam != null) { for (Anchor[][] cm : lam) { if (cm != null) { - int nx = cm.length;; + int nx = cm.length; if (nx > nxMax) { nxMax = nx; } @@ -3426,7 +3414,7 @@ public class TTXFile { return false; } if ((u1 != null) && (u2 != null)) { - if (! u1.equals(u2)) { + if (!u1.equals(u2)) { return false; } } @@ -3436,7 +3424,7 @@ public class TTXFile { return false; } if ((l1 != null) && (l2 != null)) { - if (! l1.equals(l2)) { + if (!l1.equals(l2)) { return false; } } diff --git a/test/java/org/apache/fop/complexscripts/scripts/ScriptsTestSuite.java b/test/java/org/apache/fop/complexscripts/scripts/ScriptsTestSuite.java index cf5d846b4..c48be5220 100644 --- a/test/java/org/apache/fop/complexscripts/scripts/ScriptsTestSuite.java +++ b/test/java/org/apache/fop/complexscripts/scripts/ScriptsTestSuite.java @@ -29,8 +29,6 @@ import org.apache.fop.complexscripts.scripts.arabic.ArabicTestCase; * Test suite for script specific functionality related to complex scripts. */ @RunWith(Suite.class) -@SuiteClasses({ - ArabicTestCase.class -}) +@SuiteClasses(ArabicTestCase.class) public class ScriptsTestSuite { } diff --git a/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicTestCase.java b/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicTestCase.java index d34e88a03..8542faae9 100644 --- a/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicTestCase.java +++ b/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicTestCase.java @@ -21,30 +21,26 @@ package org.apache.fop.complexscripts.scripts.arabic; import java.io.File; import java.io.FileInputStream; -import java.io.FilenameFilter; import java.io.FileNotFoundException; -import java.io.FileOutputStream; +import java.io.FilenameFilter; import java.io.IOException; -import java.io.InputStreamReader; -import java.io.LineNumberReader; import java.io.ObjectInputStream; import java.nio.IntBuffer; -import java.nio.charset.Charset; -import java.util.ArrayList; import java.util.List; -import org.apache.fop.complexscripts.fonts.GlyphPositioningTable; -import org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable; -import org.apache.fop.complexscripts.fonts.ttx.TTXFile; -import org.apache.fop.complexscripts.util.GlyphSequence; - -import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import org.apache.fop.complexscripts.fonts.GlyphPositioningTable; +import org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable; +import org.apache.fop.complexscripts.fonts.ttx.TTXFile; +import org.apache.fop.complexscripts.util.GlyphSequence; + +// CSOFF: LineLength + /** * Tests for functionality related to the arabic script. */ @@ -52,9 +48,9 @@ public class ArabicTestCase implements ArabicTestConstants { @Test public void testArabicWordForms() { - for (String sfn : srcFiles) { + for (String sfn : SRC_FILES) { try { - processWordForms(new File(datFilesDir)); + processWordForms(new File(DAT_FILES_DIR)); } catch (Exception e) { fail(e.getMessage()); } @@ -72,7 +68,7 @@ public class ArabicTestCase implements ArabicTestConstants { private String[] listWordFormFiles(File dfd) { return dfd.list(new FilenameFilter() { public boolean accept(File f, String name) { - return hasPrefixFrom(name, srcFiles) && hasExtension(name, WF_FILE_DAT_EXT); + return hasPrefixFrom(name, SRC_FILES) && hasExtension(name, WF_FILE_DAT_EXT); } private boolean hasPrefixFrom(String name, String[] prefixes) { for (String p : prefixes) { @@ -108,7 +104,7 @@ public class ArabicTestCase implements ArabicTestConstants { throw new RuntimeException(e.getMessage(), e); } finally { if (fis != null) { - try { fis.close(); } catch (Exception e) {} + try { fis.close(); } catch (Exception e) { /* NOP */ } } } } @@ -129,7 +125,7 @@ public class ArabicTestCase implements ArabicTestConstants { script = (String) d[0]; language = (String) d[1]; tfn = (String) d[3]; - tf = TTXFile.getFromCache(ttxFontsDir + File.separator + tfn); + tf = TTXFile.getFromCache(TTX_FONTS_DIR + File.separator + tfn); assertTrue(tf != null); gsub = tf.getGSUB(); assertTrue(gsub != null); diff --git a/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicTestConstants.java b/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicTestConstants.java index 0669ff137..cc9167553 100644 --- a/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicTestConstants.java +++ b/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicTestConstants.java @@ -24,22 +24,22 @@ package org.apache.fop.complexscripts.scripts.arabic; */ public interface ArabicTestConstants { - final String WF_FILE_SCRIPT = "arab"; - final String WF_FILE_LANGUAGE = "dflt"; + String WF_FILE_SCRIPT = "arab"; + String WF_FILE_LANGUAGE = "dflt"; - String srcFilesDir = "test/resources/complexscripts/arab/data"; - String datFilesDir = "test/resources/complexscripts/arab/data"; + String SRC_FILES_DIR = "test/resources/complexscripts/arab/data"; + String DAT_FILES_DIR = "test/resources/complexscripts/arab/data"; - String[] srcFiles = { + String[] SRC_FILES = { "arab-001", // unpointed word forms }; - final String WF_FILE_SRC_EXT = "txt"; - final String WF_FILE_DAT_EXT = "ser"; + String WF_FILE_SRC_EXT = "txt"; + String WF_FILE_DAT_EXT = "ser"; - String ttxFontsDir = "test/resources/complexscripts/arab/ttx"; + String TTX_FONTS_DIR = "test/resources/complexscripts/arab/ttx"; - String[] ttxFonts = { + String[] TTX_FONTS = { "arab-001.ttx", // simplified arabic "arab-002.ttx", // traditional arabic "arab-003.ttx", // lateef diff --git a/test/java/org/apache/fop/complexscripts/scripts/arabic/GenerateArabicTestData.java b/test/java/org/apache/fop/complexscripts/scripts/arabic/GenerateArabicTestData.java index a4f876dd8..9ca16a164 100644 --- a/test/java/org/apache/fop/complexscripts/scripts/arabic/GenerateArabicTestData.java +++ b/test/java/org/apache/fop/complexscripts/scripts/arabic/GenerateArabicTestData.java @@ -40,7 +40,10 @@ import org.apache.fop.complexscripts.util.GlyphSequence; /** * Tests for functionality related to the arabic script. */ -public class GenerateArabicTestData implements ArabicTestConstants { +public final class GenerateArabicTestData implements ArabicTestConstants { + + private GenerateArabicTestData() { + } public static void main(String[] args) { boolean compile = false; @@ -69,9 +72,9 @@ public class GenerateArabicTestData implements ArabicTestConstants { } private static void compile() { - for (String sfn : srcFiles) { + for (String sfn : SRC_FILES) { try { - String spn = srcFilesDir + File.separator + sfn + "." + WF_FILE_SRC_EXT; + String spn = SRC_FILES_DIR + File.separator + sfn + "." + WF_FILE_SRC_EXT; compile(WF_FILE_SCRIPT, WF_FILE_LANGUAGE, spn); } catch (Exception e) { System.err.println(e.getMessage()); @@ -81,8 +84,8 @@ public class GenerateArabicTestData implements ArabicTestConstants { private static void compile(String script, String language, String spn) { int fno = 0; - for (String tfn : ttxFonts) { - TTXFile tf = TTXFile.getFromCache(ttxFontsDir + File.separator + tfn); + for (String tfn : TTX_FONTS) { + TTXFile tf = TTXFile.getFromCache(TTX_FONTS_DIR + File.separator + tfn); assert tf != null; List data = compile(script, language, spn, tfn, tf); output(makeDataPathName(spn, fno++), data); @@ -106,7 +109,7 @@ public class GenerateArabicTestData implements ArabicTestConstants { GlyphSequence igs = tf.mapCharsToGlyphs(wf); GlyphSequence ogs = gsub.substitute(igs, script, language); int[][] paa = new int [ ogs.getGlyphCount() ] [ 4 ]; - if (! gpos.position(ogs, script, language, 1000, widths, paa)) { + if (!gpos.position(ogs, script, language, 1000, widths, paa)) { paa = null; } data.add(new Object[] { wf, getGlyphs(igs), getGlyphs(ogs), paa }); @@ -121,7 +124,7 @@ public class GenerateArabicTestData implements ArabicTestConstants { throw new RuntimeException(e.getMessage(), e); } finally { if (fis != null) { - try { fis.close(); } catch (Exception e) {} + try { fis.close(); } catch (Exception e) { /* NOP */ } } } } else { @@ -142,7 +145,7 @@ public class GenerateArabicTestData implements ArabicTestConstants { private static String makeDataPathName(String spn, int fno) { File f = new File(spn); - return datFilesDir + File.separator + stripExtension(f.getName()) + "-f" + fno + "." + WF_FILE_DAT_EXT; + return DAT_FILES_DIR + File.separator + stripExtension(f.getName()) + "-f" + fno + "." + WF_FILE_DAT_EXT; } private static String stripExtension(String s) { @@ -171,7 +174,7 @@ public class GenerateArabicTestData implements ArabicTestConstants { throw new RuntimeException(e.getMessage(), e); } finally { if (fos != null) { - try { fos.close(); } catch (Exception e) {} + try { fos.close(); } catch (Exception e) { /* NOP */ } } } } diff --git a/test/java/org/apache/fop/complexscripts/util/NumberConverterTestCase.java b/test/java/org/apache/fop/complexscripts/util/NumberConverterTestCase.java index ea885b6c5..4e1db5fb3 100644 --- a/test/java/org/apache/fop/complexscripts/util/NumberConverterTestCase.java +++ b/test/java/org/apache/fop/complexscripts/util/NumberConverterTestCase.java @@ -30,12 +30,10 @@ import static org.junit.Assert.assertEquals; /** * Test number converter functionality. - * - * @author Glenn Adams */ public class NumberConverterTestCase { - static private String[][] formatDecimal = + private static String[][] formatDecimal = { { "1" }, { "0", "0" }, @@ -45,7 +43,7 @@ public class NumberConverterTestCase { { "1000000000", "1000000000" }, }; - static private String[][] formatDecimalPadded = + private static String[][] formatDecimalPadded = { { "001" }, { "0", "000" }, @@ -58,7 +56,7 @@ public class NumberConverterTestCase { { "1000", "1000" }, }; - static private String[][] formatDecimalGrouped = + private static String[][] formatDecimalGrouped = { { "1", ",", "1" }, { "0", "0" }, @@ -68,7 +66,7 @@ public class NumberConverterTestCase { { "1000000000", "1,0,0,0,0,0,0,0,0,0" }, }; - static private String[][] formatDecimalGroupedPadded = + private static String[][] formatDecimalGroupedPadded = { { "001", ",", "2" }, { "0", "0,00" }, @@ -81,7 +79,7 @@ public class NumberConverterTestCase { { "1000", "10,00" }, }; - static private String[][] formatDecimalArabic = + private static String[][] formatDecimalArabic = { { "\u0661" }, { "0", "\u0660" }, @@ -100,7 +98,7 @@ public class NumberConverterTestCase { { "1000000000", "\u0661\u0660\u0660\u0660\u0660\u0660\u0660\u0660\u0660\u0660" }, }; - static private String[][] formatDecimalArabicPadded = + private static String[][] formatDecimalArabicPadded = { { "\u0660\u0660\u0661" }, { "0", "\u0660\u0660\u0660" }, @@ -113,7 +111,7 @@ public class NumberConverterTestCase { { "1000", "\u0661\u0660\u0660\u0660" }, }; - static private String[][] formatDecimalArabicGrouped = + private static String[][] formatDecimalArabicGrouped = { { "\u0661", "\u066c", "1" }, { "0", "\u0660" }, @@ -123,7 +121,7 @@ public class NumberConverterTestCase { { "1000000000", "\u0661\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660" }, }; - static private String[][] formatDecimalArabicGroupedPadded = + private static String[][] formatDecimalArabicGroupedPadded = { { "\u0660\u0660\u0661", "\u066c", "2" }, { "0", "\u0660\u066c\u0660\u0660" }, @@ -136,7 +134,7 @@ public class NumberConverterTestCase { { "1000", "\u0661\u0660\u066c\u0660\u0660" }, }; - static private String[][] formatDecimalThai = + private static String[][] formatDecimalThai = { { "\u0E51" }, { "0", "\u0E50" }, @@ -155,7 +153,7 @@ public class NumberConverterTestCase { { "1000000000", "\u0E51\u0E50\u0E50\u0E50\u0E50\u0E50\u0E50\u0E50\u0E50\u0E50" }, }; - static private String[][] formatDecimalThaiPadded = + private static String[][] formatDecimalThaiPadded = { { "\u0E50\u0E50\u0E51" }, { "0", "\u0E50\u0E50\u0E50" }, @@ -168,7 +166,7 @@ public class NumberConverterTestCase { { "1000", "\u0E51\u0E50\u0E50\u0E50" }, }; - static private String[][] formatRomanLower = + private static String[][] formatRomanLower = { { "i" }, { "0", "0" }, @@ -206,7 +204,7 @@ public class NumberConverterTestCase { { "5000", "5000" }, }; - static private String[][] formatRomanUpper = + private static String[][] formatRomanUpper = { { "I" }, @@ -245,7 +243,7 @@ public class NumberConverterTestCase { { "5000", "5000" }, }; - static private String[][] formatRomanLargeLower = + private static String[][] formatRomanLargeLower = { { "i", null, null, null, "large" }, { "0", "0" }, @@ -293,7 +291,7 @@ public class NumberConverterTestCase { { "200000", "200000" }, }; - static private String[][] formatRomanLargeUpper = + private static String[][] formatRomanLargeUpper = { { "I", null, null, null, "large" }, { "0", "0" }, @@ -341,7 +339,7 @@ public class NumberConverterTestCase { { "200000", "200000" }, }; - static private String[][] formatRomanNumberFormsLower = + private static String[][] formatRomanNumberFormsLower = { { "i", null, null, null, "unicode-number-forms" }, { "0", "0" }, @@ -399,7 +397,7 @@ public class NumberConverterTestCase { { "200000", "200000" }, }; - static private String[][] formatRomanNumberFormsUpper = + private static String[][] formatRomanNumberFormsUpper = { { "I", null, null, null, "unicode-number-forms" }, { "0", "0" }, @@ -457,7 +455,7 @@ public class NumberConverterTestCase { { "200000", "200000" }, }; - static private String[][] formatAlphabeticLatinLower = + private static String[][] formatAlphabeticLatinLower = { { "a" }, { "0", "0" }, @@ -478,7 +476,7 @@ public class NumberConverterTestCase { { "1000000", "bdwgn" }, }; - static private String[][] formatAlphabeticLatinUpper = + private static String[][] formatAlphabeticLatinUpper = { { "A" }, { "0", "0" }, @@ -499,7 +497,7 @@ public class NumberConverterTestCase { { "1000000", "BDWGN" }, }; - static private String[][] formatAlphabeticArabicHijai = + private static String[][] formatAlphabeticArabicHijai = { { "\u0627", null, null, "alphabetic" }, { "0", "0" }, @@ -540,7 +538,7 @@ public class NumberConverterTestCase { { "1000000", "\u0623\u0638\u0636\u0635\u062F" }, }; - static private String[][] formatAlphabeticArabicAbjadi = + private static String[][] formatAlphabeticArabicAbjadi = { { "\u0627", null, null, "traditional" }, { "0", "0" }, @@ -581,7 +579,7 @@ public class NumberConverterTestCase { { "1000000", "\u0623\u0641\u0633\u0646\u062D" }, }; - static private String[][] formatNumeralArabicAbjadi = + private static String[][] formatNumeralArabicAbjadi = { { "\u0623", null, null, "traditional" }, { "0", "0" }, @@ -629,7 +627,7 @@ public class NumberConverterTestCase { { "2000", "2000" }, }; - static private String[][] formatAlphabeticHebrew = + private static String[][] formatAlphabeticHebrew = { { "\u05D0", null, null, "alphabetic" }, { "0", "0" }, @@ -669,7 +667,7 @@ public class NumberConverterTestCase { { "1000000", "\u05D0\u05DA\u05E9\u05E8\u05D0" }, }; - static private String[][] formatNumeralHebrewGematria = + private static String[][] formatNumeralHebrewGematria = { { "\u05D0", null, null, "traditional" }, { "0", "0" }, @@ -717,7 +715,7 @@ public class NumberConverterTestCase { { "2000", "2000" }, }; - static private String[][] formatAlphabeticThai = + private static String[][] formatAlphabeticThai = { { "\u0E01", null, null, "alphabetic" }, { "0", "0" }, @@ -738,7 +736,7 @@ public class NumberConverterTestCase { { "1000000", "\u0E0B\u0E20\u0E17\u0E0C" }, }; - static private String[][] formatWordEnglishLower = + private static String[][] formatWordEnglishLower = { { "w", null, null, null, null, "eng" }, { "0", "zero" }, @@ -762,7 +760,7 @@ public class NumberConverterTestCase { { "1000000000", "one billion" } }; - static private String[][] formatWordEnglishUpper = + private static String[][] formatWordEnglishUpper = { { "W", null, null, null, null, "eng" }, { "0", "ZERO" }, @@ -786,7 +784,7 @@ public class NumberConverterTestCase { { "1000000000", "ONE BILLION" } }; - static private String[][] formatWordEnglishTitle = + private static String[][] formatWordEnglishTitle = { { "Ww", null, null, null, null, "eng" }, { "0", "Zero" }, @@ -810,7 +808,7 @@ public class NumberConverterTestCase { { "1000000000", "One Billion" } }; - static private String[][] formatWordSpanishLower = + private static String[][] formatWordSpanishLower = { { "w", null, null, null, null, "spa" }, { "0", "cero" }, @@ -890,7 +888,7 @@ public class NumberConverterTestCase { { "1000000000", "mil millones" } }; - static private String[][] formatWordSpanishUpper = + private static String[][] formatWordSpanishUpper = { { "W", null, null, null, null, "spa" }, { "0", "CERO" }, @@ -970,7 +968,7 @@ public class NumberConverterTestCase { { "1000000000", "MIL MILLONES" } }; - static private String[][] formatWordSpanishTitle = + private static String[][] formatWordSpanishTitle = { { "Ww", null, null, null, null, "spa" }, { "0", "Cero" }, @@ -1050,7 +1048,7 @@ public class NumberConverterTestCase { { "1000000000", "Mil Millones" } }; - static private String[][] formatWordFrenchLower = + private static String[][] formatWordFrenchLower = { { "w", null, null, null, null, "fra" }, { "0", "z\u00e9ro" }, @@ -1141,7 +1139,7 @@ public class NumberConverterTestCase { { "1000000000", "un milliard" } }; - static private String[][] formatWordFrenchUpper = + private static String[][] formatWordFrenchUpper = { { "W", null, null, null, null, "fra" }, { "0", "Z\u00c9RO" }, @@ -1232,7 +1230,7 @@ public class NumberConverterTestCase { { "1000000000", "UN MILLIARD" } }; - static private String[][] formatWordFrenchTitle = + private static String[][] formatWordFrenchTitle = { { "Ww", null, null, null, null, "fra" }, { "0", "Z\u00e9ro" }, diff --git a/test/java/org/apache/fop/complexscripts/util/UtilTestSuite.java b/test/java/org/apache/fop/complexscripts/util/UtilTestSuite.java index 70bd568af..4407254a8 100644 --- a/test/java/org/apache/fop/complexscripts/util/UtilTestSuite.java +++ b/test/java/org/apache/fop/complexscripts/util/UtilTestSuite.java @@ -27,8 +27,6 @@ import org.junit.runners.Suite.SuiteClasses; * Test suite for bidirectional functionality. */ @RunWith(Suite.class) -@SuiteClasses({ - NumberConverterTestCase.class -}) +@SuiteClasses(NumberConverterTestCase.class) public class UtilTestSuite { } diff --git a/test/java/org/apache/fop/config/FontAttributesMissingTestCase.java b/test/java/org/apache/fop/config/FontAttributesMissingTestCase.java index 8d7d46928..fa4babfa2 100644 --- a/test/java/org/apache/fop/config/FontAttributesMissingTestCase.java +++ b/test/java/org/apache/fop/config/FontAttributesMissingTestCase.java @@ -24,7 +24,6 @@ import java.io.IOException; import org.xml.sax.SAXException; import org.apache.fop.apps.FopConfBuilder; -import org.apache.fop.apps.MimeConstants; import org.apache.fop.apps.PDFRendererConfBuilder; /** diff --git a/test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java b/test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java index 84e8ee804..591104412 100644 --- a/test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java +++ b/test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java @@ -24,7 +24,6 @@ import java.io.IOException; import org.xml.sax.SAXException; import org.apache.fop.apps.FopConfBuilder; -import org.apache.fop.apps.MimeConstants; import org.apache.fop.apps.PDFRendererConfBuilder; /** diff --git a/test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java b/test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java index 3479c3794..11538dc33 100644 --- a/test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java +++ b/test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java @@ -24,7 +24,6 @@ import java.io.IOException; import org.xml.sax.SAXException; import org.apache.fop.apps.FopConfBuilder; -import org.apache.fop.apps.MimeConstants; import org.apache.fop.apps.PDFRendererConfBuilder; /** diff --git a/test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java b/test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java index 800e06d32..4bacc180c 100644 --- a/test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java +++ b/test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java @@ -24,7 +24,6 @@ import java.io.IOException; import org.xml.sax.SAXException; import org.apache.fop.apps.FopConfBuilder; -import org.apache.fop.apps.MimeConstants; import org.apache.fop.apps.PDFRendererConfBuilder; /** diff --git a/test/java/org/apache/fop/config/FontsAutoDetectTestCase.java b/test/java/org/apache/fop/config/FontsAutoDetectTestCase.java index c9f6d98ff..e05e44ab1 100644 --- a/test/java/org/apache/fop/config/FontsAutoDetectTestCase.java +++ b/test/java/org/apache/fop/config/FontsAutoDetectTestCase.java @@ -24,7 +24,6 @@ import java.io.IOException; import org.xml.sax.SAXException; import org.apache.fop.apps.FopConfBuilder; -import org.apache.fop.apps.MimeConstants; import org.apache.fop.apps.PDFRendererConfBuilder; public class FontsAutoDetectTestCase extends BaseConstructiveUserConfigTest { diff --git a/test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java b/test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java index 2776c2cce..aab7a2e7c 100644 --- a/test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java +++ b/test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java @@ -24,7 +24,6 @@ import java.io.IOException; import org.xml.sax.SAXException; import org.apache.fop.apps.FopConfBuilder; -import org.apache.fop.apps.MimeConstants; import org.apache.fop.apps.PDFRendererConfBuilder; /** diff --git a/test/java/org/apache/fop/datatypes/URISpecificationTestCase.java b/test/java/org/apache/fop/datatypes/URISpecificationTestCase.java index 23af20a1a..f6e2b02ba 100644 --- a/test/java/org/apache/fop/datatypes/URISpecificationTestCase.java +++ b/test/java/org/apache/fop/datatypes/URISpecificationTestCase.java @@ -19,10 +19,10 @@ package org.apache.fop.datatypes; -import static org.junit.Assert.assertEquals; - import org.junit.Test; +import static org.junit.Assert.assertEquals; + /** * Tests for URISpecification. */ diff --git a/test/java/org/apache/fop/events/BasicEventTestCase.java b/test/java/org/apache/fop/events/BasicEventTestCase.java index 87fc04329..39e3fec98 100644 --- a/test/java/org/apache/fop/events/BasicEventTestCase.java +++ b/test/java/org/apache/fop/events/BasicEventTestCase.java @@ -19,6 +19,8 @@ package org.apache.fop.events; +import org.junit.Test; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; @@ -26,7 +28,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import org.apache.fop.events.model.EventSeverity; -import org.junit.Test; public class BasicEventTestCase { diff --git a/test/java/org/apache/fop/events/TestEventProducer.java b/test/java/org/apache/fop/events/TestEventProducer.java index ff0bc2a81..ff19c7ea6 100644 --- a/test/java/org/apache/fop/events/TestEventProducer.java +++ b/test/java/org/apache/fop/events/TestEventProducer.java @@ -38,7 +38,10 @@ public interface TestEventProducer extends EventProducer { */ void enjoy(Object source, String what); - public class Provider { + public static final class Provider { + + private Provider() { + } public static TestEventProducer get(EventBroadcaster broadcaster) { return (TestEventProducer)broadcaster.getEventProducerFor(TestEventProducer.class); diff --git a/test/java/org/apache/fop/fo/DelegatingFOEventHandlerTestCase.java b/test/java/org/apache/fop/fo/DelegatingFOEventHandlerTestCase.java index 313379e02..226c551fb 100644 --- a/test/java/org/apache/fop/fo/DelegatingFOEventHandlerTestCase.java +++ b/test/java/org/apache/fop/fo/DelegatingFOEventHandlerTestCase.java @@ -19,8 +19,6 @@ package org.apache.fop.fo; -import static org.junit.Assert.assertArrayEquals; - import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; @@ -42,6 +40,8 @@ import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; +import static org.junit.Assert.assertArrayEquals; + import org.apache.fop.apps.FOUserAgent; import org.apache.fop.fo.FODocumentParser.FOEventHandlerFactory; import org.apache.fop.fo.flow.BasicLink; diff --git a/test/java/org/apache/fop/fo/FODocumentParser.java b/test/java/org/apache/fop/fo/FODocumentParser.java index 7d03e38a6..2e691519b 100644 --- a/test/java/org/apache/fop/fo/FODocumentParser.java +++ b/test/java/org/apache/fop/fo/FODocumentParser.java @@ -64,7 +64,7 @@ public final class FODocumentParser { /** * A factory to create custom instances of {@link FOEventHandler}. */ - public static interface FOEventHandlerFactory { + public interface FOEventHandlerFactory { /** * Creates a new {@code FOEventHandler} instance parameterized with the given FO user agent. diff --git a/test/java/org/apache/fop/fo/FONodeMocks.java b/test/java/org/apache/fop/fo/FONodeMocks.java index ba969b9fa..97889c177 100644 --- a/test/java/org/apache/fop/fo/FONodeMocks.java +++ b/test/java/org/apache/fop/fo/FONodeMocks.java @@ -31,7 +31,6 @@ import org.apache.xmlgraphics.image.loader.ImageManager; import org.apache.xmlgraphics.image.loader.ImageSessionContext; import org.apache.fop.apps.FOUserAgent; -import org.apache.fop.apps.FopFactory; import org.apache.fop.events.EventBroadcaster; import org.apache.fop.fo.flow.table.ColumnNumberManager; import org.apache.fop.fo.flow.table.ColumnNumberManagerHolder; @@ -46,7 +45,7 @@ public final class FONodeMocks { /** * Creates and returns a mock {@link FONode} configured with a mock * {@link FOEventHandler}. The FO event handler returns a mock {@link FOUserAgent}, - * which in turn returns a mock {@link FopFactory}, which returns a mock + * which in turn returns a mock {@link org.apache.fop.apps.FopFactory}, which returns a mock * {@link ImageManager}. * * @return a mock FO node diff --git a/test/java/org/apache/fop/fo/flow/MarkersTestCase.java b/test/java/org/apache/fop/fo/flow/MarkersTestCase.java index 983a531b0..09a4e129c 100644 --- a/test/java/org/apache/fop/fo/flow/MarkersTestCase.java +++ b/test/java/org/apache/fop/fo/flow/MarkersTestCase.java @@ -30,10 +30,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import org.apache.fop.fo.Constants; -import org.apache.fop.fo.flow.Marker; -import org.apache.fop.fo.flow.Markers; -import org.apache.fop.fo.flow.RetrieveMarker; -import org.apache.fop.fo.flow.RetrieveTableMarker; public class MarkersTestCase { diff --git a/test/java/org/apache/fop/fo/flow/table/AbstractTableTest.java b/test/java/org/apache/fop/fo/flow/table/AbstractTableTest.java index fb6ec6a25..0f0e347d3 100644 --- a/test/java/org/apache/fop/fo/flow/table/AbstractTableTest.java +++ b/test/java/org/apache/fop/fo/flow/table/AbstractTableTest.java @@ -24,8 +24,8 @@ import java.util.Iterator; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.fo.FODocumentParser; -import org.apache.fop.fo.FOEventHandler; import org.apache.fop.fo.FODocumentParser.FOEventHandlerFactory; +import org.apache.fop.fo.FOEventHandler; import org.apache.fop.util.ConsoleEventListenerForTests; /** diff --git a/test/java/org/apache/fop/fo/flow/table/CollapsedConditionalBorderTestCase.java b/test/java/org/apache/fop/fo/flow/table/CollapsedConditionalBorderTestCase.java index 7c0301ca7..75ba53525 100644 --- a/test/java/org/apache/fop/fo/flow/table/CollapsedConditionalBorderTestCase.java +++ b/test/java/org/apache/fop/fo/flow/table/CollapsedConditionalBorderTestCase.java @@ -19,18 +19,20 @@ package org.apache.fop.fo.flow.table; -import static org.junit.Assert.assertEquals; - import java.awt.Color; import java.util.Iterator; import java.util.List; import org.junit.Test; +import static org.junit.Assert.assertEquals; + import org.apache.fop.fo.Constants; import org.apache.fop.fo.FONode.FONodeIterator; import org.apache.fop.fo.properties.CommonBorderPaddingBackground.BorderInfo; +// CSOFF: LineLength + /** * A testcase for the resolution of collapsed borders in the FO tree, taking * conditionality into account. The resolved borders are generated by the diff --git a/test/java/org/apache/fop/fo/flow/table/RowGroupBuilderTestCase.java b/test/java/org/apache/fop/fo/flow/table/RowGroupBuilderTestCase.java index 361517a66..884116441 100644 --- a/test/java/org/apache/fop/fo/flow/table/RowGroupBuilderTestCase.java +++ b/test/java/org/apache/fop/fo/flow/table/RowGroupBuilderTestCase.java @@ -19,16 +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; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + /** * Tests that RowGroupBuilder returns, for each part of a table, the expected number of * row-groups with the expected number or rows in each. diff --git a/test/java/org/apache/fop/fo/flow/table/TableColumnColumnNumberTestCase.java b/test/java/org/apache/fop/fo/flow/table/TableColumnColumnNumberTestCase.java index a21806559..2df0cac2a 100644 --- a/test/java/org/apache/fop/fo/flow/table/TableColumnColumnNumberTestCase.java +++ b/test/java/org/apache/fop/fo/flow/table/TableColumnColumnNumberTestCase.java @@ -19,12 +19,12 @@ package org.apache.fop.fo.flow.table; -import static org.junit.Assert.assertEquals; - import java.util.Iterator; import org.junit.Test; +import static org.junit.Assert.assertEquals; + import org.apache.fop.datatypes.PercentBaseContext; import org.apache.fop.fo.FObj; diff --git a/test/java/org/apache/fop/fo/flow/table/TableHandler.java b/test/java/org/apache/fop/fo/flow/table/TableHandler.java index 11f24b99b..04da32b47 100644 --- a/test/java/org/apache/fop/fo/flow/table/TableHandler.java +++ b/test/java/org/apache/fop/fo/flow/table/TableHandler.java @@ -24,7 +24,6 @@ import java.util.List; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.fo.FOEventHandler; -import org.apache.fop.fo.flow.table.Table; public class TableHandler extends FOEventHandler { diff --git a/test/java/org/apache/fop/fo/pagination/AllTests.java b/test/java/org/apache/fop/fo/pagination/AllTests.java index 40990cb06..bd5b21c14 100644 --- a/test/java/org/apache/fop/fo/pagination/AllTests.java +++ b/test/java/org/apache/fop/fo/pagination/AllTests.java @@ -19,8 +19,8 @@ package org.apache.fop.fo.pagination; -import org.junit.runners.Suite; import org.junit.runner.RunWith; +import org.junit.runners.Suite; /** * All test to be added in FOTreeTestSuite @@ -28,6 +28,6 @@ import org.junit.runner.RunWith; */ @RunWith(Suite.class) @Suite.SuiteClasses({ PageSequenceMasterTestCase.class, - RepeatablePageMasterAlternativesTestCase.class}) + RepeatablePageMasterAlternativesTestCase.class }) public final class AllTests { } diff --git a/test/java/org/apache/fop/fo/pagination/PageSequenceMasterTestCase.java b/test/java/org/apache/fop/fo/pagination/PageSequenceMasterTestCase.java index ad4f991ac..d7bc2e11c 100644 --- a/test/java/org/apache/fop/fo/pagination/PageSequenceMasterTestCase.java +++ b/test/java/org/apache/fop/fo/pagination/PageSequenceMasterTestCase.java @@ -19,8 +19,10 @@ package org.apache.fop.fo.pagination; -import static org.junit.Assert.fail; +import org.junit.Test; +import org.xml.sax.Locator; +import static org.junit.Assert.fail; import static org.mockito.Matchers.anyBoolean; import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.anyObject; @@ -33,8 +35,6 @@ import static org.mockito.Mockito.when; import org.apache.fop.apps.FOPException; import org.apache.fop.fo.FONode; import org.apache.fop.layoutmgr.BlockLevelEventProducer; -import org.junit.Test; -import org.xml.sax.Locator; /** diff --git a/test/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternativesTestCase.java b/test/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternativesTestCase.java index 5ac4860dc..ce1a97638 100644 --- a/test/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternativesTestCase.java +++ b/test/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternativesTestCase.java @@ -19,6 +19,8 @@ package org.apache.fop.fo.pagination; +import org.junit.Test; + import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.anyBoolean; import static org.mockito.Matchers.anyInt; @@ -30,8 +32,6 @@ import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.expr.NumericProperty; import org.apache.fop.fo.properties.Property; -import org.junit.Test; - /** * Unit Test for RepeatablePageMasterAlternatives * diff --git a/test/java/org/apache/fop/fo/properties/AltTextHolderTestCase.java b/test/java/org/apache/fop/fo/properties/AltTextHolderTestCase.java index cd5d545ff..89ed2733d 100644 --- a/test/java/org/apache/fop/fo/properties/AltTextHolderTestCase.java +++ b/test/java/org/apache/fop/fo/properties/AltTextHolderTestCase.java @@ -19,12 +19,12 @@ package org.apache.fop.fo.properties; +import org.junit.Test; + import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import org.junit.Test; - import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.fo.Constants; diff --git a/test/java/org/apache/fop/fo/properties/CommonAccessibilityHolderTestCase.java b/test/java/org/apache/fop/fo/properties/CommonAccessibilityHolderTestCase.java index 352a39713..81ebc2f41 100644 --- a/test/java/org/apache/fop/fo/properties/CommonAccessibilityHolderTestCase.java +++ b/test/java/org/apache/fop/fo/properties/CommonAccessibilityHolderTestCase.java @@ -19,16 +19,16 @@ package org.apache.fop.fo.properties; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.List; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import org.apache.fop.fo.Constants; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FONodeMocks; diff --git a/test/java/org/apache/fop/fonts/DejaVuLGCSerifTestCase.java b/test/java/org/apache/fop/fonts/DejaVuLGCSerifTestCase.java index 20212b002..8c2621b51 100644 --- a/test/java/org/apache/fop/fonts/DejaVuLGCSerifTestCase.java +++ b/test/java/org/apache/fop/fonts/DejaVuLGCSerifTestCase.java @@ -24,11 +24,11 @@ import java.io.File; import org.junit.Before; import org.junit.Test; +import static org.junit.Assert.assertEquals; + import org.apache.fop.apps.io.InternalResourceResolver; import org.apache.fop.apps.io.ResourceResolverFactory; -import static org.junit.Assert.assertEquals; - /** * */ diff --git a/test/java/org/apache/fop/fonts/EmbedFontInfoTestCase.java b/test/java/org/apache/fop/fonts/EmbedFontInfoTestCase.java index d156b908c..c8099f860 100644 --- a/test/java/org/apache/fop/fonts/EmbedFontInfoTestCase.java +++ b/test/java/org/apache/fop/fonts/EmbedFontInfoTestCase.java @@ -35,6 +35,8 @@ import static org.junit.Assert.assertTrue; */ public class EmbedFontInfoTestCase { + public EmbedFontInfoTestCase() { } + private EmbedFontInfo sut; private final URI metricsURI = URI.create("test/resources/fonts/ttf/glb12.ttf.xml"); diff --git a/test/java/org/apache/fop/fonts/FontManagerConfiguratorTestCase.java b/test/java/org/apache/fop/fonts/FontManagerConfiguratorTestCase.java index 073743c13..d653171b7 100644 --- a/test/java/org/apache/fop/fonts/FontManagerConfiguratorTestCase.java +++ b/test/java/org/apache/fop/fonts/FontManagerConfiguratorTestCase.java @@ -20,7 +20,6 @@ package org.apache.fop.fonts; import java.io.File; -import java.io.FileNotFoundException; import java.io.IOException; import java.net.URI; @@ -28,13 +27,14 @@ import org.junit.Before; import org.junit.Test; import org.xml.sax.SAXException; +import static org.junit.Assert.assertEquals; + import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FopConfBuilder; import org.apache.fop.apps.FopConfParser; import org.apache.fop.apps.FopFactory; import static org.apache.fop.apps.FopConfParserTestCase.getFopFactory; -import static org.junit.Assert.assertEquals; /** * A test case for {@link FontManagerConfigurator}. @@ -84,7 +84,7 @@ public class FontManagerConfiguratorTestCase { /** * This test is an interesting one; it's basically testing that if a base URI pointing to a * directory that doesn't exist is used, an error is not thrown. The URI resolver should handle - * any {@link FileNotFoundException}s, not the configuration. We're NOT testing whether a font + * any {@link java.io.FileNotFoundException}s, not the configuration. We're NOT testing whether a font * can be resolved here, just that the URI resolver accepts it as its base URI. */ @Test diff --git a/test/java/org/apache/fop/fonts/FontsTestSuite.java b/test/java/org/apache/fop/fonts/FontsTestSuite.java index ad48c46c4..1baba49df 100644 --- a/test/java/org/apache/fop/fonts/FontsTestSuite.java +++ b/test/java/org/apache/fop/fonts/FontsTestSuite.java @@ -29,7 +29,7 @@ import org.junit.runners.Suite.SuiteClasses; @RunWith(Suite.class) @SuiteClasses({ FontManagerConfiguratorTestCase.class, - EmbedFontInfo.class, + EmbedFontInfoTestCase.class, FontEventProcessingTestCase.class, FontManagerConfiguratorTestCase.class }) diff --git a/test/java/org/apache/fop/fonts/cff/CFFDataReaderTestCase.java b/test/java/org/apache/fop/fonts/cff/CFFDataReaderTestCase.java index 64c7642eb..97ea5c52b 100644 --- a/test/java/org/apache/fop/fonts/cff/CFFDataReaderTestCase.java +++ b/test/java/org/apache/fop/fonts/cff/CFFDataReaderTestCase.java @@ -26,14 +26,14 @@ import java.util.Random; import org.junit.Before; import org.junit.Test; +import static org.junit.Assert.assertEquals; + import org.apache.fontbox.cff.CFFDataInput; import org.apache.fop.fonts.cff.CFFDataReader.CFFIndexData; import org.apache.fop.fonts.cff.CFFDataReader.DICTEntry; import org.apache.fop.fonts.truetype.OTFSubSetFile; -import static org.junit.Assert.assertEquals; - public class CFFDataReaderTestCase { private CFFDataReader cffReader; @@ -113,7 +113,7 @@ public class CFFDataReaderTestCase { //Array comparison int[] fontBBox = { -50, -40, 100, 120 }; DICTEntry fontBBoxEntry = dictMap.get("FontBBox"); - for (int i = 0;i < fontBBoxEntry.getOperands().size();i++) { + for (int i = 0; i < fontBBoxEntry.getOperands().size(); i++) { assertEquals(fontBBoxEntry.getOperands().get(i).intValue(), fontBBox[i]); } //Multi-byte offset (number) @@ -141,7 +141,7 @@ public class CFFDataReaderTestCase { }; Random randGen = new Random(); byte[] data = new byte[31]; - for (int i = 0;i < data.length;i++) { + for (int i = 0; i < data.length; i++) { data[i] = (byte)randGen.nextInt(255); } testIndex = OTFSubSetFile.concatArray(testIndex, data); diff --git a/test/java/org/apache/fop/fonts/truetype/GlyfTableTestCase.java b/test/java/org/apache/fop/fonts/truetype/GlyfTableTestCase.java index e794ab1a8..952c3ec1f 100644 --- a/test/java/org/apache/fop/fonts/truetype/GlyfTableTestCase.java +++ b/test/java/org/apache/fop/fonts/truetype/GlyfTableTestCase.java @@ -37,7 +37,7 @@ import static org.junit.Assert.assertTrue; */ public class GlyfTableTestCase { - private final static class DirData { + private static final class DirData { final long offset; final long length; diff --git a/test/java/org/apache/fop/fonts/truetype/OTFFileTestCase.java b/test/java/org/apache/fop/fonts/truetype/OTFFileTestCase.java index 737c2e05e..b4e2cee2e 100644 --- a/test/java/org/apache/fop/fonts/truetype/OTFFileTestCase.java +++ b/test/java/org/apache/fop/fonts/truetype/OTFFileTestCase.java @@ -20,7 +20,6 @@ package org.apache.fop.fonts.truetype; import java.io.FileInputStream; -import java.io.IOException; import java.io.InputStream; import org.junit.Before; @@ -37,7 +36,7 @@ public class OTFFileTestCase { /** * Initializes fonts used for the testing of reading OTF CFF - * @throws IOException + * @throws java.io.IOException */ @Before public void setUp() throws Exception { @@ -75,11 +74,11 @@ public class OTFFileTestCase { int[] gids = {32, 42, 44, 47}; int[] sourceSansWidths = {516, 555, 572, 383}; - for (int i = 0;i < gids.length;i++) { + for (int i = 0; i < gids.length; i++) { assertEquals(sourceSansWidths[i], sourceSansProBold.getWidths()[gids[i]]); } int[] carolynaWidths = {842, 822, 658, 784}; - for (int i = 0;i < gids.length;i++) { + for (int i = 0; i < gids.length; i++) { assertEquals(carolynaWidths[i], alexBrush.getWidths()[gids[i]]); } } diff --git a/test/java/org/apache/fop/fonts/truetype/OTFSubSetFileTestCase.java b/test/java/org/apache/fop/fonts/truetype/OTFSubSetFileTestCase.java index 604cca3a8..c555ebc20 100644 --- a/test/java/org/apache/fop/fonts/truetype/OTFSubSetFileTestCase.java +++ b/test/java/org/apache/fop/fonts/truetype/OTFSubSetFileTestCase.java @@ -27,6 +27,9 @@ import java.util.Map; import org.junit.Before; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.apache.fontbox.cff.CFFDataInput; import org.apache.fontbox.cff.CFFFont; import org.apache.fontbox.cff.CFFParser; @@ -37,9 +40,6 @@ import org.apache.fop.fonts.cff.CFFDataReader; import org.apache.fop.fonts.cff.CFFDataReader.CFFIndexData; import org.apache.fop.fonts.cff.CFFDataReader.DICTEntry; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - public class OTFSubSetFileTestCase extends OTFFileTestCase { CFFDataReader cffReaderSourceSans; @@ -85,7 +85,7 @@ public class OTFSubSetFileTestCase extends OTFFileTestCase { private boolean checkCorrectOffsets(CFFIndexData indexData) { int last = 0; - for (int i = 0;i < indexData.getOffsets().length;i++) { + for (int i = 0; i < indexData.getOffsets().length; i++) { if (indexData.getOffsets()[i] < last) { return false; } @@ -107,7 +107,7 @@ public class OTFSubSetFileTestCase extends OTFFileTestCase { IndexData localIndexData = CFFParser.readIndexData(localSubrs); CFFIndexData charStrings = cffReader.getCharStringIndex(); - for (int i = 0;i < charStrings.getNumObjects();i++) { + for (int i = 0; i < charStrings.getNumObjects(); i++) { byte[] charData = charStrings.getValue(i); Type2CharStringParser parser = new Type2CharStringParser(); diff --git a/test/java/org/apache/fop/fonts/truetype/TTFFileTestCase.java b/test/java/org/apache/fop/fonts/truetype/TTFFileTestCase.java index a390bef0f..32e527f9d 100644 --- a/test/java/org/apache/fop/fonts/truetype/TTFFileTestCase.java +++ b/test/java/org/apache/fop/fonts/truetype/TTFFileTestCase.java @@ -26,12 +26,12 @@ import java.util.Map; import org.junit.Test; -import org.apache.fop.fonts.truetype.OpenFont.PostScriptVersion; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import org.apache.fop.fonts.truetype.OpenFont.PostScriptVersion; + /** * Class for testing org.apache.fop.fonts.truetype.TTFFile */ diff --git a/test/java/org/apache/fop/fonts/truetype/TTFFontLoaderTestCase.java b/test/java/org/apache/fop/fonts/truetype/TTFFontLoaderTestCase.java index f50b116ac..899fe1d73 100644 --- a/test/java/org/apache/fop/fonts/truetype/TTFFontLoaderTestCase.java +++ b/test/java/org/apache/fop/fonts/truetype/TTFFontLoaderTestCase.java @@ -25,14 +25,14 @@ import java.net.URI; import org.junit.Test; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.fop.apps.io.InternalResourceResolver; import org.apache.fop.apps.io.ResourceResolverFactory; import org.apache.fop.fonts.EmbeddingMode; import org.apache.fop.fonts.EncodingMode; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - /** * Test case for {@link OFFontLoader}. */ diff --git a/test/java/org/apache/fop/fonts/type1/AFMParserTestCase.java b/test/java/org/apache/fop/fonts/type1/AFMParserTestCase.java index 93443a0d9..5e31054b5 100644 --- a/test/java/org/apache/fop/fonts/type1/AFMParserTestCase.java +++ b/test/java/org/apache/fop/fonts/type1/AFMParserTestCase.java @@ -19,9 +19,6 @@ package org.apache.fop.fonts.type1; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import java.awt.Rectangle; import java.io.IOException; import java.io.InputStream; @@ -29,6 +26,9 @@ import java.util.List; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + /** * Test case for {@link AFMParser}. */ diff --git a/test/java/org/apache/fop/fonts/type1/AdobeStandardEncodingTestCase.java b/test/java/org/apache/fop/fonts/type1/AdobeStandardEncodingTestCase.java index 10ba42119..a3a3e1c40 100644 --- a/test/java/org/apache/fop/fonts/type1/AdobeStandardEncodingTestCase.java +++ b/test/java/org/apache/fop/fonts/type1/AdobeStandardEncodingTestCase.java @@ -19,8 +19,6 @@ package org.apache.fop.fonts.type1; -import static org.junit.Assert.assertEquals; - import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.IOException; @@ -30,6 +28,8 @@ import java.io.InputStreamReader; import org.junit.BeforeClass; import org.junit.Test; +import static org.junit.Assert.assertEquals; + /** * Test case for {@link AdobeStandardEncoding}. */ diff --git a/test/java/org/apache/fop/fonts/type1/CharMetricsHandlerTestCase.java b/test/java/org/apache/fop/fonts/type1/CharMetricsHandlerTestCase.java index de9af2d33..c3e9334dd 100644 --- a/test/java/org/apache/fop/fonts/type1/CharMetricsHandlerTestCase.java +++ b/test/java/org/apache/fop/fonts/type1/CharMetricsHandlerTestCase.java @@ -19,10 +19,6 @@ package org.apache.fop.fonts.type1; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - import java.awt.Rectangle; import java.io.IOException; import java.util.HashMap; @@ -31,6 +27,10 @@ import java.util.Stack; import org.junit.Test; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import org.apache.fop.fonts.NamedCharacter; import org.apache.fop.fonts.type1.AFMParser.ValueHandler; diff --git a/test/java/org/apache/fop/fotreetest/ext/AssertElement.java b/test/java/org/apache/fop/fotreetest/ext/AssertElement.java index 5070984d1..955644ae4 100644 --- a/test/java/org/apache/fop/fotreetest/ext/AssertElement.java +++ b/test/java/org/apache/fop/fotreetest/ext/AssertElement.java @@ -20,6 +20,9 @@ package org.apache.fop.fotreetest.ext; +import org.xml.sax.Attributes; +import org.xml.sax.Locator; + import org.apache.fop.apps.FOPException; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FOPropertyMapping; @@ -32,9 +35,6 @@ import org.apache.fop.fo.properties.Property; import org.apache.fop.fo.properties.SpaceProperty; import org.apache.fop.fotreetest.ResultCollector; -import org.xml.sax.Attributes; -import org.xml.sax.Locator; - /** * Defines the assert element for the FOP Test extension. */ diff --git a/test/java/org/apache/fop/fotreetest/ext/TestElementMapping.java b/test/java/org/apache/fop/fotreetest/ext/TestElementMapping.java index eee0efac4..b61944eae 100644 --- a/test/java/org/apache/fop/fotreetest/ext/TestElementMapping.java +++ b/test/java/org/apache/fop/fotreetest/ext/TestElementMapping.java @@ -19,8 +19,8 @@ package org.apache.fop.fotreetest.ext; -import org.apache.fop.fo.FONode; import org.apache.fop.fo.ElementMapping; +import org.apache.fop.fo.FONode; /** * This class provides the element mapping for FOP. diff --git a/test/java/org/apache/fop/image/loader/batik/ImageLoaderTestCase.java b/test/java/org/apache/fop/image/loader/batik/ImageLoaderTestCase.java index f4763512a..7f3036c24 100644 --- a/test/java/org/apache/fop/image/loader/batik/ImageLoaderTestCase.java +++ b/test/java/org/apache/fop/image/loader/batik/ImageLoaderTestCase.java @@ -19,10 +19,6 @@ 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; @@ -30,6 +26,10 @@ import java.io.File; import org.junit.Ignore; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; + import org.apache.xmlgraphics.image.loader.Image; import org.apache.xmlgraphics.image.loader.ImageFlavor; import org.apache.xmlgraphics.image.loader.ImageInfo; diff --git a/test/java/org/apache/fop/image/loader/batik/ImagePreloaderTestCase.java b/test/java/org/apache/fop/image/loader/batik/ImagePreloaderTestCase.java index efc5df1f7..3d690b67c 100644 --- a/test/java/org/apache/fop/image/loader/batik/ImagePreloaderTestCase.java +++ b/test/java/org/apache/fop/image/loader/batik/ImagePreloaderTestCase.java @@ -19,15 +19,15 @@ package org.apache.fop.image.loader.batik; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - import java.io.File; import java.io.IOException; import org.junit.Ignore; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + import org.apache.xmlgraphics.image.loader.ImageException; import org.apache.xmlgraphics.image.loader.ImageInfo; import org.apache.xmlgraphics.image.loader.ImageManager; diff --git a/test/java/org/apache/fop/intermediate/AbstractIFTest.java b/test/java/org/apache/fop/intermediate/AbstractIFTest.java index 419db2c47..48c3f335b 100644 --- a/test/java/org/apache/fop/intermediate/AbstractIFTest.java +++ b/test/java/org/apache/fop/intermediate/AbstractIFTest.java @@ -34,7 +34,6 @@ import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; import org.w3c.dom.Document; - import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; diff --git a/test/java/org/apache/fop/intermediate/AreaTreeXMLFormatTestSuite.java b/test/java/org/apache/fop/intermediate/AreaTreeXMLFormatTestSuite.java index 3fc855cef..2003958c8 100644 --- a/test/java/org/apache/fop/intermediate/AreaTreeXMLFormatTestSuite.java +++ b/test/java/org/apache/fop/intermediate/AreaTreeXMLFormatTestSuite.java @@ -27,6 +27,6 @@ import org.junit.runners.Suite.SuiteClasses; * JUnit test suite for the area tree XML format */ @RunWith(Suite.class) -@SuiteClasses({ AreaTreeParserTestCase.class }) +@SuiteClasses(AreaTreeParserTestCase.class) public class AreaTreeXMLFormatTestSuite { } diff --git a/test/java/org/apache/fop/intermediate/IFMimickingTestCase.java b/test/java/org/apache/fop/intermediate/IFMimickingTestCase.java index 58281fc10..83dd88661 100644 --- a/test/java/org/apache/fop/intermediate/IFMimickingTestCase.java +++ b/test/java/org/apache/fop/intermediate/IFMimickingTestCase.java @@ -19,8 +19,6 @@ package org.apache.fop.intermediate; -import static org.junit.Assert.fail; - import java.io.File; import javax.xml.transform.ErrorListener; @@ -34,6 +32,8 @@ import javax.xml.transform.stream.StreamSource; import org.junit.Before; import org.junit.Test; +import static org.junit.Assert.fail; + import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.Fop; diff --git a/test/java/org/apache/fop/intermediate/IntermediateFormatTestSuite.java b/test/java/org/apache/fop/intermediate/IntermediateFormatTestSuite.java index f960990b2..71b26cb9b 100644 --- a/test/java/org/apache/fop/intermediate/IntermediateFormatTestSuite.java +++ b/test/java/org/apache/fop/intermediate/IntermediateFormatTestSuite.java @@ -27,6 +27,6 @@ import org.junit.runners.Suite.SuiteClasses; * A test suite for testing the Intermediate Format output. */ @RunWith(Suite.class) -@SuiteClasses({ IFTestCase.class }) +@SuiteClasses(IFTestCase.class) public final class IntermediateFormatTestSuite { } diff --git a/test/java/org/apache/fop/intermediate/LayoutIFTestSuite.java b/test/java/org/apache/fop/intermediate/LayoutIFTestSuite.java index 5d87df1a5..ea60f2ff4 100644 --- a/test/java/org/apache/fop/intermediate/LayoutIFTestSuite.java +++ b/test/java/org/apache/fop/intermediate/LayoutIFTestSuite.java @@ -27,6 +27,6 @@ import org.junit.runners.Suite.SuiteClasses; * JUnit test suite for the intermediate format */ @RunWith(Suite.class) -@SuiteClasses({ IFParserTestCase.class }) +@SuiteClasses(IFParserTestCase.class) public final class LayoutIFTestSuite { } diff --git a/test/java/org/apache/fop/layoutengine/ElementListCheck.java b/test/java/org/apache/fop/layoutengine/ElementListCheck.java index e63fc3291..4d33d670b 100644 --- a/test/java/org/apache/fop/layoutengine/ElementListCheck.java +++ b/test/java/org/apache/fop/layoutengine/ElementListCheck.java @@ -22,16 +22,17 @@ package org.apache.fop.layoutengine; import java.util.Iterator; import java.util.List; -import org.apache.fop.layoutmgr.KnuthBox; -import org.apache.fop.layoutmgr.KnuthElement; -import org.apache.fop.layoutmgr.KnuthGlue; -import org.apache.fop.layoutmgr.KnuthPenalty; import org.w3c.dom.CDATASection; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Text; +import org.apache.fop.layoutmgr.KnuthBox; +import org.apache.fop.layoutmgr.KnuthElement; +import org.apache.fop.layoutmgr.KnuthGlue; +import org.apache.fop.layoutmgr.KnuthPenalty; + /** * Check implementation that checks a Knuth element list. */ diff --git a/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java b/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java index 2a70f255d..89bf28a55 100644 --- a/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java +++ b/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java @@ -27,6 +27,6 @@ import org.junit.runners.Suite.SuiteClasses; * JUnit test suit for running layout engine test under JUnit control. */ @RunWith(Suite.class) -@SuiteClasses({ LayoutEngineTestCase.class }) +@SuiteClasses(LayoutEngineTestCase.class) public class LayoutEngineTestSuite { } diff --git a/test/java/org/apache/fop/layoutengine/LayoutResult.java b/test/java/org/apache/fop/layoutengine/LayoutResult.java index 52c83daa8..92c459234 100644 --- a/test/java/org/apache/fop/layoutengine/LayoutResult.java +++ b/test/java/org/apache/fop/layoutengine/LayoutResult.java @@ -19,9 +19,10 @@ package org.apache.fop.layoutengine; -import org.apache.fop.apps.FormattingResults; import org.w3c.dom.Document; +import org.apache.fop.apps.FormattingResults; + /** * This class holds references to all the results from the FOP processing run. */ diff --git a/test/java/org/apache/fop/layoutmgr/table/TableCellLayoutManagerTestCase.java b/test/java/org/apache/fop/layoutmgr/table/TableCellLayoutManagerTestCase.java index c2fc84551..629e5f1c6 100644 --- a/test/java/org/apache/fop/layoutmgr/table/TableCellLayoutManagerTestCase.java +++ b/test/java/org/apache/fop/layoutmgr/table/TableCellLayoutManagerTestCase.java @@ -23,6 +23,10 @@ import java.awt.Color; import org.junit.Test; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import org.apache.fop.fo.flow.table.PrimaryGridUnit; import org.apache.fop.fo.flow.table.Table; import org.apache.fop.fo.flow.table.TableCell; @@ -37,10 +41,6 @@ import org.apache.fop.layoutmgr.PageSequenceLayoutManager; import org.apache.fop.layoutmgr.PositionIterator; import org.apache.fop.layoutmgr.RetrieveTableMarkerLayoutManager; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - public class TableCellLayoutManagerTestCase { // this test aims to check that the first call to addAreas() calls diff --git a/test/java/org/apache/fop/logging/LoggingElementListObserver.java b/test/java/org/apache/fop/logging/LoggingElementListObserver.java index 26c4db00e..7824a6b8b 100644 --- a/test/java/org/apache/fop/logging/LoggingElementListObserver.java +++ b/test/java/org/apache/fop/logging/LoggingElementListObserver.java @@ -24,9 +24,10 @@ import java.util.ListIterator; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + +import org.apache.fop.layoutmgr.ElementListObserver.Observer; import org.apache.fop.layoutmgr.ElementListUtils; import org.apache.fop.layoutmgr.ListElement; -import org.apache.fop.layoutmgr.ElementListObserver.Observer; /** * <p>Logs all observed element lists. diff --git a/test/java/org/apache/fop/memory/MemoryEater.java b/test/java/org/apache/fop/memory/MemoryEater.java index 7afb80476..efe0cc489 100644 --- a/test/java/org/apache/fop/memory/MemoryEater.java +++ b/test/java/org/apache/fop/memory/MemoryEater.java @@ -45,7 +45,7 @@ import org.apache.fop.apps.MimeConstants; /** * Debug tool to create and process large FO files by replicating them a specified number of times. */ -public class MemoryEater { +public final class MemoryEater { private SAXTransformerFactory tFactory = (SAXTransformerFactory)SAXTransformerFactory.newInstance(); @@ -53,7 +53,7 @@ public class MemoryEater { private Stats stats; - public MemoryEater() throws TransformerConfigurationException, MalformedURLException { + private MemoryEater() throws TransformerConfigurationException, MalformedURLException { File xsltFile = new File("test/xsl/fo-replicator.xsl"); Source xslt = new StreamSource(xsltFile); replicatorTemplates = tFactory.newTemplates(xslt); diff --git a/test/java/org/apache/fop/pdf/AbstractPDFStreamTestCase.java b/test/java/org/apache/fop/pdf/AbstractPDFStreamTestCase.java index 95d5c0a1d..dec62c0a4 100644 --- a/test/java/org/apache/fop/pdf/AbstractPDFStreamTestCase.java +++ b/test/java/org/apache/fop/pdf/AbstractPDFStreamTestCase.java @@ -23,10 +23,11 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; -import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; +import static org.junit.Assert.assertEquals; + /** * Test case for {@link AbstractPDFStream}. */ diff --git a/test/java/org/apache/fop/pdf/FileIDGeneratorTestCase.java b/test/java/org/apache/fop/pdf/FileIDGeneratorTestCase.java index a9d7bf4f6..3301fff9e 100644 --- a/test/java/org/apache/fop/pdf/FileIDGeneratorTestCase.java +++ b/test/java/org/apache/fop/pdf/FileIDGeneratorTestCase.java @@ -19,10 +19,6 @@ 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; @@ -33,6 +29,10 @@ import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + /** * Tests the {@link FileIDGenerator} class. */ @@ -96,7 +96,7 @@ public class FileIDGeneratorTestCase { assertTrue(Arrays.equals(originalFileID, updatedFileID)); } - private static interface TestGetter { + private interface TestGetter { FileIDGenerator getSut() throws Exception; } diff --git a/test/java/org/apache/fop/pdf/ObjectStreamManagerTestCase.java b/test/java/org/apache/fop/pdf/ObjectStreamManagerTestCase.java index 89d980029..21eb6088f 100644 --- a/test/java/org/apache/fop/pdf/ObjectStreamManagerTestCase.java +++ b/test/java/org/apache/fop/pdf/ObjectStreamManagerTestCase.java @@ -19,15 +19,15 @@ package org.apache.fop.pdf; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import java.io.IOException; import java.io.OutputStream; import java.util.List; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.apache.fop.pdf.xref.CompressedObjectReference; public class ObjectStreamManagerTestCase { diff --git a/test/java/org/apache/fop/pdf/ObjectStreamTestCase.java b/test/java/org/apache/fop/pdf/ObjectStreamTestCase.java index 317828e4b..3512e1147 100644 --- a/test/java/org/apache/fop/pdf/ObjectStreamTestCase.java +++ b/test/java/org/apache/fop/pdf/ObjectStreamTestCase.java @@ -19,8 +19,6 @@ package org.apache.fop.pdf; -import static org.junit.Assert.assertEquals; - import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; @@ -29,6 +27,8 @@ import java.util.List; import org.junit.Before; import org.junit.Test; +import static org.junit.Assert.assertEquals; + public class ObjectStreamTestCase { private static final String OBJECT_CONTENT = "<<\n /Foo True\n /Bar False\n>>\n"; diff --git a/test/java/org/apache/fop/pdf/PDFAModeTestCase.java b/test/java/org/apache/fop/pdf/PDFAModeTestCase.java index 352e0710e..68609575a 100644 --- a/test/java/org/apache/fop/pdf/PDFAModeTestCase.java +++ b/test/java/org/apache/fop/pdf/PDFAModeTestCase.java @@ -97,7 +97,7 @@ public class PDFAModeTestCase { } @Test - public void checkPDFA_1a() { + public void checkPDFA1a() { new PDFAModeChecker(PDFAMode.PDFA_1A) .isEnabled() .isPart1() @@ -106,7 +106,7 @@ public class PDFAModeTestCase { } @Test - public void checkPDFA_1b() { + public void checkPDFA1b() { new PDFAModeChecker(PDFAMode.PDFA_1B) .isEnabled() .isPart1() @@ -115,7 +115,7 @@ public class PDFAModeTestCase { } @Test - public void checkPDFA_2a() { + public void checkPDFA2a() { new PDFAModeChecker(PDFAMode.PDFA_2A) .isEnabled() .isNotPart1() @@ -124,7 +124,7 @@ public class PDFAModeTestCase { } @Test - public void checkPDFA_2b() { + public void checkPDFA2b() { new PDFAModeChecker(PDFAMode.PDFA_2B) .isEnabled() .isNotPart1() @@ -133,7 +133,7 @@ public class PDFAModeTestCase { } @Test - public void checkPDFA_2u() { + public void checkPDFA2u() { new PDFAModeChecker(PDFAMode.PDFA_2U) .isEnabled() .isNotPart1() diff --git a/test/java/org/apache/fop/pdf/PDFArrayTestCase.java b/test/java/org/apache/fop/pdf/PDFArrayTestCase.java index 418b2f1a9..53e9bdba0 100644 --- a/test/java/org/apache/fop/pdf/PDFArrayTestCase.java +++ b/test/java/org/apache/fop/pdf/PDFArrayTestCase.java @@ -19,17 +19,17 @@ package org.apache.fop.pdf; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import org.junit.Before; import org.junit.Test; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; /** * Test case for {@link PDFArray}. diff --git a/test/java/org/apache/fop/pdf/PDFDestsTestCase.java b/test/java/org/apache/fop/pdf/PDFDestsTestCase.java index 08d841ede..4655b258d 100644 --- a/test/java/org/apache/fop/pdf/PDFDestsTestCase.java +++ b/test/java/org/apache/fop/pdf/PDFDestsTestCase.java @@ -19,20 +19,20 @@ package org.apache.fop.pdf; -import org.junit.Before; -import org.junit.Test; - import java.io.IOException; import java.util.ArrayList; import java.util.List; +import org.junit.Before; +import org.junit.Test; + /** * Test case for {@link PDFDests}. */ public class PDFDestsTestCase extends PDFObjectTestCase { private PDFDests dests = new PDFDests(); - private String expectedString = "<< /Names [(number) 10 (name) /Test#20name] >>\n"; + private String expectedString = "<< /Names [(number) 10 (name) /Test#20name] >>"; @Before public void setUp() { diff --git a/test/java/org/apache/fop/pdf/PDFDictionaryTestCase.java b/test/java/org/apache/fop/pdf/PDFDictionaryTestCase.java index 3f84fac2e..267e05c2c 100644 --- a/test/java/org/apache/fop/pdf/PDFDictionaryTestCase.java +++ b/test/java/org/apache/fop/pdf/PDFDictionaryTestCase.java @@ -19,17 +19,18 @@ package org.apache.fop.pdf; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; - import java.io.ByteArrayOutputStream; import java.io.IOException; -import org.apache.commons.io.output.CountingOutputStream; import org.junit.Before; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +import org.apache.commons.io.output.CountingOutputStream; + /** * Test case for {@link PDFDictionary}. @@ -47,7 +48,7 @@ public class PDFDictionaryTestCase extends PDFObjectTestCase { + " /array [1 (two) 20]\n" + " /number 20\n" + " /null null\n" - + ">>\n"; + + ">>"; @Before public void setUp() { diff --git a/test/java/org/apache/fop/pdf/PDFDocumentGraphics2DTestCase.java b/test/java/org/apache/fop/pdf/PDFDocumentGraphics2DTestCase.java index c7eff506e..880613a78 100644 --- a/test/java/org/apache/fop/pdf/PDFDocumentGraphics2DTestCase.java +++ b/test/java/org/apache/fop/pdf/PDFDocumentGraphics2DTestCase.java @@ -24,8 +24,6 @@ import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics2D; -import junit.framework.Assert; - import org.junit.Test; import org.apache.commons.io.output.ByteArrayOutputStream; @@ -34,6 +32,8 @@ import org.apache.xmlgraphics.util.UnitConv; import org.apache.fop.svg.PDFDocumentGraphics2D; +import junit.framework.Assert; + /** * Tests for {@link PDFDocumentGraphics2D}. */ diff --git a/test/java/org/apache/fop/pdf/PDFDocumentTestCase.java b/test/java/org/apache/fop/pdf/PDFDocumentTestCase.java index 8965635b9..e58201f13 100644 --- a/test/java/org/apache/fop/pdf/PDFDocumentTestCase.java +++ b/test/java/org/apache/fop/pdf/PDFDocumentTestCase.java @@ -19,12 +19,12 @@ package org.apache.fop.pdf; -import static org.junit.Assert.assertEquals; +import java.io.ByteArrayOutputStream; +import java.io.IOException; import org.junit.Test; -import java.io.ByteArrayOutputStream; -import java.io.IOException; +import static org.junit.Assert.assertEquals; /** * Test case for {@link PDFDocument} diff --git a/test/java/org/apache/fop/pdf/PDFEncodingTestCase.java b/test/java/org/apache/fop/pdf/PDFEncodingTestCase.java index 34e48f1a6..2f80b077c 100644 --- a/test/java/org/apache/fop/pdf/PDFEncodingTestCase.java +++ b/test/java/org/apache/fop/pdf/PDFEncodingTestCase.java @@ -19,11 +19,11 @@ package org.apache.fop.pdf; import org.junit.Test; -import org.apache.fop.fonts.CodePointMapping; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import org.apache.fop.fonts.CodePointMapping; + public class PDFEncodingTestCase { /** diff --git a/test/java/org/apache/fop/pdf/PDFEncryptionJCETestCase.java b/test/java/org/apache/fop/pdf/PDFEncryptionJCETestCase.java index ea3b011c7..e3f8344e0 100644 --- a/test/java/org/apache/fop/pdf/PDFEncryptionJCETestCase.java +++ b/test/java/org/apache/fop/pdf/PDFEncryptionJCETestCase.java @@ -19,10 +19,6 @@ package org.apache.fop.pdf; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; @@ -43,6 +39,10 @@ import javax.crypto.spec.SecretKeySpec; import org.junit.Test; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + /** * Tests the {@link PDFEncryptionJCE} class. */ diff --git a/test/java/org/apache/fop/pdf/PDFFilterListTestCase.java b/test/java/org/apache/fop/pdf/PDFFilterListTestCase.java index 2504d871a..d1cc6273d 100644 --- a/test/java/org/apache/fop/pdf/PDFFilterListTestCase.java +++ b/test/java/org/apache/fop/pdf/PDFFilterListTestCase.java @@ -19,10 +19,10 @@ package org.apache.fop.pdf; -import static org.junit.Assert.assertFalse; - import org.junit.Test; +import static org.junit.Assert.assertFalse; + public class PDFFilterListTestCase { @Test diff --git a/test/java/org/apache/fop/pdf/PDFNameTestCase.java b/test/java/org/apache/fop/pdf/PDFNameTestCase.java index 80917f416..8d7321496 100644 --- a/test/java/org/apache/fop/pdf/PDFNameTestCase.java +++ b/test/java/org/apache/fop/pdf/PDFNameTestCase.java @@ -22,11 +22,13 @@ package org.apache.fop.pdf; import java.io.ByteArrayOutputStream; import java.io.IOException; -import org.apache.commons.io.output.CountingOutputStream; import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.fail; + import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +import org.apache.commons.io.output.CountingOutputStream; /** * Test class for {@link PDFName}. diff --git a/test/java/org/apache/fop/pdf/PDFNullTestCase.java b/test/java/org/apache/fop/pdf/PDFNullTestCase.java index 98427cd20..87dacc7f6 100644 --- a/test/java/org/apache/fop/pdf/PDFNullTestCase.java +++ b/test/java/org/apache/fop/pdf/PDFNullTestCase.java @@ -19,12 +19,12 @@ package org.apache.fop.pdf; -import static org.junit.Assert.assertEquals; +import java.io.ByteArrayOutputStream; +import java.io.IOException; import org.junit.Test; -import java.io.ByteArrayOutputStream; -import java.io.IOException; +import static org.junit.Assert.assertEquals; /** * Test case for {@link PDFNull}. diff --git a/test/java/org/apache/fop/pdf/PDFNumberTestCase.java b/test/java/org/apache/fop/pdf/PDFNumberTestCase.java index ed660af8d..65f484dc7 100644 --- a/test/java/org/apache/fop/pdf/PDFNumberTestCase.java +++ b/test/java/org/apache/fop/pdf/PDFNumberTestCase.java @@ -19,13 +19,13 @@ package org.apache.fop.pdf; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; +import java.io.IOException; import org.junit.Before; import org.junit.Test; -import java.io.IOException; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; /** * This test tests PDFNumber's doubleOut() methods. diff --git a/test/java/org/apache/fop/pdf/PDFNumsArrayTestCase.java b/test/java/org/apache/fop/pdf/PDFNumsArrayTestCase.java index e0dca33bf..d36775cda 100644 --- a/test/java/org/apache/fop/pdf/PDFNumsArrayTestCase.java +++ b/test/java/org/apache/fop/pdf/PDFNumsArrayTestCase.java @@ -19,11 +19,11 @@ package org.apache.fop.pdf; +import java.io.IOException; + import org.junit.Before; import org.junit.Test; -import java.io.IOException; - /** * Test case for {@link PDFNumsArray}. */ diff --git a/test/java/org/apache/fop/pdf/PDFObjectTestCase.java b/test/java/org/apache/fop/pdf/PDFObjectTestCase.java index 10ffa3b27..f35d2a15c 100644 --- a/test/java/org/apache/fop/pdf/PDFObjectTestCase.java +++ b/test/java/org/apache/fop/pdf/PDFObjectTestCase.java @@ -19,17 +19,17 @@ package org.apache.fop.pdf; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - import java.io.ByteArrayOutputStream; import java.io.IOException; import org.junit.Before; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + /** * Tests the PDFObject class. */ diff --git a/test/java/org/apache/fop/pdf/PDFPageLabelsTestCase.java b/test/java/org/apache/fop/pdf/PDFPageLabelsTestCase.java index e982bf246..a8be7ee74 100644 --- a/test/java/org/apache/fop/pdf/PDFPageLabelsTestCase.java +++ b/test/java/org/apache/fop/pdf/PDFPageLabelsTestCase.java @@ -37,11 +37,11 @@ public class PDFPageLabelsTestCase { int index = 0; StringBuilder expected = new StringBuilder(); expected.append("["); - expected.append(index + " << /S /r >>\n"); + expected.append(index + " << /S /r >>"); pageLabels.addPageLabel(index++, "i"); pageLabels.addPageLabel(index++, "ii"); pageLabels.addPageLabel(index++, "iii"); - expected.append(" " + index + " << /S /D >>\n"); + expected.append(" " + index + " << /S /D >>"); pageLabels.addPageLabel(index++, "1"); pageLabels.addPageLabel(index++, "2"); pageLabels.addPageLabel(index++, "3"); @@ -52,33 +52,33 @@ public class PDFPageLabelsTestCase { pageLabels.addPageLabel(index++, "8"); pageLabels.addPageLabel(index++, "9"); pageLabels.addPageLabel(index++, "10"); - expected.append(" " + index + " << /S /A >>\n"); + expected.append(" " + index + " << /S /A >>"); pageLabels.addPageLabel(index++, "A"); pageLabels.addPageLabel(index++, "B"); - expected.append(" " + index + " << /S /R /St 100 >>\n"); + expected.append(" " + index + " << /S /R /St 100 >>"); pageLabels.addPageLabel(index++, "C"); - expected.append(" " + index + " << /S /R /St 500 >>\n"); + expected.append(" " + index + " << /S /R /St 500 >>"); pageLabels.addPageLabel(index++, "D"); - expected.append(" " + index + " << /S /A /St 5 >>\n"); + expected.append(" " + index + " << /S /A /St 5 >>"); pageLabels.addPageLabel(index++, "E"); pageLabels.addPageLabel(index++, "F"); pageLabels.addPageLabel(index++, "G"); - expected.append(" " + index + " << /P (aa) >>\n"); + expected.append(" " + index + " << /P (aa) >>"); pageLabels.addPageLabel(index++, "aa"); - expected.append(" " + index + " << /P (ab) >>\n"); + expected.append(" " + index + " << /P (ab) >>"); pageLabels.addPageLabel(index++, "ab"); - expected.append(" " + index + " << /P (ac) >>\n"); + expected.append(" " + index + " << /P (ac) >>"); pageLabels.addPageLabel(index++, "ac"); - expected.append(" " + index + " << /S /a >>\n"); + expected.append(" " + index + " << /S /a >>"); pageLabels.addPageLabel(index++, "a"); pageLabels.addPageLabel(index++, "b"); - expected.append(" " + index + " << /S /R /St 2 >>\n"); + expected.append(" " + index + " << /S /R /St 2 >>"); pageLabels.addPageLabel(index++, "II"); - expected.append(" " + index + " << /S /R /St 12 >>\n"); + expected.append(" " + index + " << /S /R /St 12 >>"); pageLabels.addPageLabel(index++, "XII"); - expected.append(" " + index + " <<\n /P (00)\n /S /D\n /St 9\n>>\n"); + expected.append(" " + index + " <<\n /P (00)\n /S /D\n /St 9\n>>"); pageLabels.addPageLabel(index++, "009"); - expected.append(" " + index + " <<\n /P (0)\n /S /D\n /St 10\n>>\n"); + expected.append(" " + index + " <<\n /P (0)\n /S /D\n /St 10\n>>"); pageLabels.addPageLabel(index++, "010"); pageLabels.addPageLabel(index++, "011"); expected.append("]"); diff --git a/test/java/org/apache/fop/pdf/PDFRectangleTestCase.java b/test/java/org/apache/fop/pdf/PDFRectangleTestCase.java index 24b6a1c71..ed87cd23e 100644 --- a/test/java/org/apache/fop/pdf/PDFRectangleTestCase.java +++ b/test/java/org/apache/fop/pdf/PDFRectangleTestCase.java @@ -19,14 +19,14 @@ package org.apache.fop.pdf; -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + /** * Test case for {@link PDFRectangle}. */ diff --git a/test/java/org/apache/fop/pdf/PDFReferenceTestCase.java b/test/java/org/apache/fop/pdf/PDFReferenceTestCase.java index a2c6193cf..4e0e8814d 100644 --- a/test/java/org/apache/fop/pdf/PDFReferenceTestCase.java +++ b/test/java/org/apache/fop/pdf/PDFReferenceTestCase.java @@ -19,12 +19,12 @@ package org.apache.fop.pdf; -import static org.junit.Assert.assertEquals; +import java.io.ByteArrayOutputStream; +import java.io.IOException; import org.junit.Test; -import java.io.ByteArrayOutputStream; -import java.io.IOException; +import static org.junit.Assert.assertEquals; /** * Test case for {@link PDFReference}. diff --git a/test/java/org/apache/fop/pdf/PDFStreamTestCase.java b/test/java/org/apache/fop/pdf/PDFStreamTestCase.java index 93dcea511..b5fb66e00 100644 --- a/test/java/org/apache/fop/pdf/PDFStreamTestCase.java +++ b/test/java/org/apache/fop/pdf/PDFStreamTestCase.java @@ -19,17 +19,17 @@ package org.apache.fop.pdf; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - import java.io.ByteArrayOutputStream; import java.io.IOException; import org.junit.Before; import org.junit.Test; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + public class PDFStreamTestCase { private PDFStream stream; @@ -118,7 +118,7 @@ public class PDFStreamTestCase { private byte[] createSampleStreamData() throws IOException { ByteArrayOutputStream stream = new ByteArrayOutputStream(); - stream.write("stream\n".getBytes("US-ASCII")); + stream.write("\nstream\n".getBytes("US-ASCII")); stream.write(createSampleData()); stream.write("\nendstream".getBytes("US-ASCII")); return stream.toByteArray(); diff --git a/test/java/org/apache/fop/pdf/TableHeaderScopeTestCase.java b/test/java/org/apache/fop/pdf/TableHeaderScopeTestCase.java index a1d581402..2fa5008ed 100644 --- a/test/java/org/apache/fop/pdf/TableHeaderScopeTestCase.java +++ b/test/java/org/apache/fop/pdf/TableHeaderScopeTestCase.java @@ -109,14 +109,14 @@ public class TableHeaderScopeTestCase { } private PDFDictionary scopeAttribute(Scope scope) { - return argThat(new isScopeAttribute(scope)); + return argThat(new IsScopeAttribute(scope)); } - private static class isScopeAttribute extends ArgumentMatcher<PDFDictionary> { + private static class IsScopeAttribute extends ArgumentMatcher<PDFDictionary> { private final Scope expectedScope; - public isScopeAttribute(Scope expectedScope) { + public IsScopeAttribute(Scope expectedScope) { this.expectedScope = expectedScope; } diff --git a/test/java/org/apache/fop/pdf/VersionControllerTestCase.java b/test/java/org/apache/fop/pdf/VersionControllerTestCase.java index 74637c91f..e14fc9502 100644 --- a/test/java/org/apache/fop/pdf/VersionControllerTestCase.java +++ b/test/java/org/apache/fop/pdf/VersionControllerTestCase.java @@ -19,13 +19,13 @@ package org.apache.fop.pdf; +import org.junit.Before; +import org.junit.Test; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.fail; -import org.junit.Before; -import org.junit.Test; - /** * A test class for {@link VersionController}. diff --git a/test/java/org/apache/fop/pdf/VersionTestCase.java b/test/java/org/apache/fop/pdf/VersionTestCase.java index 9c90f0966..dd2731d8b 100644 --- a/test/java/org/apache/fop/pdf/VersionTestCase.java +++ b/test/java/org/apache/fop/pdf/VersionTestCase.java @@ -19,11 +19,11 @@ package org.apache.fop.pdf; +import org.junit.Test; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import org.junit.Test; - /** * This is a test case for ({@link Version}. */ diff --git a/test/java/org/apache/fop/pdf/xref/CompressedObjectReferenceTestCase.java b/test/java/org/apache/fop/pdf/xref/CompressedObjectReferenceTestCase.java index 8b103d277..b7a326c64 100644 --- a/test/java/org/apache/fop/pdf/xref/CompressedObjectReferenceTestCase.java +++ b/test/java/org/apache/fop/pdf/xref/CompressedObjectReferenceTestCase.java @@ -19,14 +19,14 @@ package org.apache.fop.pdf.xref; -import static org.junit.Assert.assertArrayEquals; - import java.io.IOException; import java.util.Arrays; import java.util.List; import org.junit.Test; +import static org.junit.Assert.assertArrayEquals; + public class CompressedObjectReferenceTestCase extends ObjectReferenceTest { @Test diff --git a/test/java/org/apache/fop/pdf/xref/CrossReferenceObjectTest.java b/test/java/org/apache/fop/pdf/xref/CrossReferenceObjectTest.java index df1b86e53..cd55577cd 100644 --- a/test/java/org/apache/fop/pdf/xref/CrossReferenceObjectTest.java +++ b/test/java/org/apache/fop/pdf/xref/CrossReferenceObjectTest.java @@ -19,8 +19,6 @@ package org.apache.fop.pdf.xref; -import static org.junit.Assert.assertArrayEquals; - import java.io.ByteArrayOutputStream; import java.io.FileOutputStream; import java.io.IOException; @@ -32,6 +30,8 @@ import java.util.Map; import org.junit.Before; +import static org.junit.Assert.assertArrayEquals; + import org.apache.fop.pdf.PDFDocument; import org.apache.fop.pdf.PDFInfo; import org.apache.fop.pdf.PDFPages; diff --git a/test/java/org/apache/fop/pdf/xref/CrossReferenceTableTestCase.java b/test/java/org/apache/fop/pdf/xref/CrossReferenceTableTestCase.java index ceff96a91..12f6e3c1b 100644 --- a/test/java/org/apache/fop/pdf/xref/CrossReferenceTableTestCase.java +++ b/test/java/org/apache/fop/pdf/xref/CrossReferenceTableTestCase.java @@ -73,7 +73,7 @@ public class CrossReferenceTableTestCase extends CrossReferenceObjectTest { .append(" /Info 2 0 R\n") .append(" /ID [<0123456789ABCDEF> <0123456789ABCDEF>]\n") .append(" /Size ").append(Integer.toString(offsets.size() + 1)).append('\n') - .append(">>\n"); + .append(">>"); return getBytes(expected); } diff --git a/test/java/org/apache/fop/pdf/xref/UncompressedObjectReferenceTestCase.java b/test/java/org/apache/fop/pdf/xref/UncompressedObjectReferenceTestCase.java index b147084e8..a9f506aaa 100644 --- a/test/java/org/apache/fop/pdf/xref/UncompressedObjectReferenceTestCase.java +++ b/test/java/org/apache/fop/pdf/xref/UncompressedObjectReferenceTestCase.java @@ -19,8 +19,6 @@ package org.apache.fop.pdf.xref; -import static org.junit.Assert.assertArrayEquals; - import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; @@ -28,6 +26,8 @@ import java.util.List; import org.junit.Test; +import static org.junit.Assert.assertArrayEquals; + public class UncompressedObjectReferenceTestCase extends ObjectReferenceTest { @Test diff --git a/test/java/org/apache/fop/render/AbstractRenderingTest.java b/test/java/org/apache/fop/render/AbstractRenderingTest.java index 9d196e71d..297a9ba05 100644 --- a/test/java/org/apache/fop/render/AbstractRenderingTest.java +++ b/test/java/org/apache/fop/render/AbstractRenderingTest.java @@ -33,6 +33,7 @@ import javax.xml.transform.stream.StreamSource; 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; diff --git a/test/java/org/apache/fop/render/RawPNGTestUtil.java b/test/java/org/apache/fop/render/RawPNGTestUtil.java index e6660bb42..506556c66 100644 --- a/test/java/org/apache/fop/render/RawPNGTestUtil.java +++ b/test/java/org/apache/fop/render/RawPNGTestUtil.java @@ -28,9 +28,9 @@ import org.apache.xmlgraphics.image.loader.ImageSize; public final class RawPNGTestUtil { - private static int NUM_ROWS = 32; - private static int NUM_COLUMNS = 32; - private static int DPI = 72; + private static final int NUM_ROWS = 32; + private static final int NUM_COLUMNS = 32; + private static final int DPI = 72; private RawPNGTestUtil() { @@ -83,7 +83,7 @@ public final class RawPNGTestUtil { } /** - * + * * @return a default ImageSize */ public static ImageSize getImageSize() { diff --git a/test/java/org/apache/fop/render/RendererFactoryTestCase.java b/test/java/org/apache/fop/render/RendererFactoryTestCase.java index 4bed835ec..1fa4ae0fa 100644 --- a/test/java/org/apache/fop/render/RendererFactoryTestCase.java +++ b/test/java/org/apache/fop/render/RendererFactoryTestCase.java @@ -19,13 +19,13 @@ package org.apache.fop.render; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - import java.io.File; import org.junit.Test; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import org.apache.commons.io.output.NullOutputStream; import org.apache.fop.apps.FOPException; diff --git a/test/java/org/apache/fop/render/afp/AFPBorderPainterTestCase.java b/test/java/org/apache/fop/render/afp/AFPBorderPainterTestCase.java index 691d75f3f..dfe956d90 100644 --- a/test/java/org/apache/fop/render/afp/AFPBorderPainterTestCase.java +++ b/test/java/org/apache/fop/render/afp/AFPBorderPainterTestCase.java @@ -19,12 +19,15 @@ package org.apache.fop.render.afp; -import static org.junit.Assert.assertTrue; - import java.awt.Color; import java.io.ByteArrayOutputStream; import java.io.OutputStream; +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + import org.apache.fop.afp.AFPBorderPainter; import org.apache.fop.afp.AFPLineDataInfo; import org.apache.fop.afp.AFPPaintingState; @@ -32,8 +35,6 @@ import org.apache.fop.afp.BorderPaintingInfo; import org.apache.fop.afp.DataStream; import org.apache.fop.afp.Factory; import org.apache.fop.fo.Constants; -import org.junit.Before; -import org.junit.Test; public class AFPBorderPainterTestCase { private ByteArrayOutputStream outStream; @@ -63,12 +64,12 @@ public class AFPBorderPainterTestCase { ds.endDocument(); assertTrue(line.getX1() == 4999 && line.getX2() == 8332); } - + class MyDataStream extends DataStream { public MyDataStream(Factory factory, AFPPaintingState paintingState, OutputStream outputStream) { super(factory, paintingState, outputStream); } - + public void createLine(AFPLineDataInfo lineDataInfo) { line = lineDataInfo; } diff --git a/test/java/org/apache/fop/render/afp/AFPRendererConfigParserTestCase.java b/test/java/org/apache/fop/render/afp/AFPRendererConfigParserTestCase.java index 799045872..8ed54049f 100644 --- a/test/java/org/apache/fop/render/afp/AFPRendererConfigParserTestCase.java +++ b/test/java/org/apache/fop/render/afp/AFPRendererConfigParserTestCase.java @@ -25,6 +25,10 @@ import java.util.Map; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + import org.apache.fop.afp.AFPConstants; import org.apache.fop.apps.AFPRendererConfBuilder; import org.apache.fop.apps.AbstractRendererConfigParserTester; @@ -33,9 +37,6 @@ import org.apache.fop.render.afp.AFPRendererConfig.ImagesModeOptions; import static org.apache.fop.render.afp.AFPRendererConfig.ImagesModeOptions.MODE_COLOR; import static org.apache.fop.render.afp.AFPRendererConfig.ImagesModeOptions.MODE_GRAYSCALE; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; public class AFPRendererConfigParserTestCase extends AbstractRendererConfigParserTester<AFPRendererConfBuilder, AFPRendererConfig> { diff --git a/test/java/org/apache/fop/render/afp/AFPRendererConfiguratorTestCase.java b/test/java/org/apache/fop/render/afp/AFPRendererConfiguratorTestCase.java index 115b3149a..48cf89240 100644 --- a/test/java/org/apache/fop/render/afp/AFPRendererConfiguratorTestCase.java +++ b/test/java/org/apache/fop/render/afp/AFPRendererConfiguratorTestCase.java @@ -24,6 +24,9 @@ import java.util.Map; import org.junit.Test; import org.mockito.ArgumentCaptor; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.verify; + import org.apache.fop.afp.AFPResourceLevel; import org.apache.fop.afp.AFPResourceLevel.ResourceType; import org.apache.fop.afp.AFPResourceLevelDefaults; @@ -33,9 +36,6 @@ import org.apache.fop.apps.MimeConstants; import org.apache.fop.render.afp.AFPRendererConfig.AFPRendererConfigParser; import org.apache.fop.render.afp.AFPRendererConfig.ImagesModeOptions; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.verify; - public class AFPRendererConfiguratorTestCase extends AbstractRendererConfiguratorTest<AFPRendererConfigurator, AFPRendererConfBuilder> { diff --git a/test/java/org/apache/fop/render/afp/NoOperationTestCase.java b/test/java/org/apache/fop/render/afp/NoOperationTestCase.java index 78578a2b6..9e83829f8 100644 --- a/test/java/org/apache/fop/render/afp/NoOperationTestCase.java +++ b/test/java/org/apache/fop/render/afp/NoOperationTestCase.java @@ -19,20 +19,22 @@ package org.apache.fop.render.afp; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + import org.apache.commons.io.IOUtils; + import org.apache.fop.afp.AFPConstants; import org.apache.fop.afp.parser.MODCAParser; import org.apache.fop.afp.parser.UnparsedStructuredField; import org.apache.fop.apps.FOUserAgent; -import org.junit.Test; /** * Tests generation of afp:no-operation (NOPs). diff --git a/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfigParserTester.java b/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfigParserTester.java index 04f872a84..cae184d51 100644 --- a/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfigParserTester.java +++ b/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfigParserTester.java @@ -24,6 +24,11 @@ import java.awt.image.BufferedImage; import org.junit.Test; +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 org.apache.fop.apps.AbstractRendererConfigParserTester; import org.apache.fop.apps.BitmapRendererConfBuilder; import org.apache.fop.render.bitmap.BitmapRendererConfig.BitmapRendererConfigParser; @@ -36,10 +41,6 @@ import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE_RGBA; import static org.apache.fop.render.bitmap.BitmapRendererOption.JAVA2D_TRANSPARENT_PAGE_BACKGROUND; import static org.apache.fop.render.bitmap.BitmapRendererOption.RENDERING_QUALITY; import static org.apache.fop.render.bitmap.BitmapRendererOption.RENDERING_SPEED; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; public class AbstractBitmapRendererConfigParserTester extends AbstractRendererConfigParserTester<BitmapRendererConfBuilder, BitmapRendererConfig> { diff --git a/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfiguratorTest.java b/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfiguratorTest.java index 3e0c8c203..dcbb27754 100644 --- a/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfiguratorTest.java +++ b/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfiguratorTest.java @@ -23,6 +23,11 @@ import java.awt.image.BufferedImage; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + import org.apache.fop.apps.AbstractRendererConfiguratorTest; import org.apache.fop.apps.BitmapRendererConfBuilder; import org.apache.fop.render.intermediate.IFDocumentHandler; @@ -35,10 +40,6 @@ import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE_RGB; import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE_RGBA; import static org.apache.fop.render.bitmap.BitmapRendererOption.RENDERING_QUALITY; import static org.apache.fop.render.bitmap.BitmapRendererOption.RENDERING_SPEED; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; public abstract class AbstractBitmapRendererConfiguratorTest extends AbstractRendererConfiguratorTest<BitmapRendererConfigurator, BitmapRendererConfBuilder> { diff --git a/test/java/org/apache/fop/render/bitmap/TIFFRendererConfigParserTestCase.java b/test/java/org/apache/fop/render/bitmap/TIFFRendererConfigParserTestCase.java index d33076983..8a5c2a72d 100644 --- a/test/java/org/apache/fop/render/bitmap/TIFFRendererConfigParserTestCase.java +++ b/test/java/org/apache/fop/render/bitmap/TIFFRendererConfigParserTestCase.java @@ -21,16 +21,16 @@ package org.apache.fop.render.bitmap; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.xmlgraphics.image.writer.Endianness; import org.apache.fop.apps.FopConfBuilder; import org.apache.fop.apps.TIFFRendererConfBuilder; import org.apache.fop.render.bitmap.TIFFRendererConfig.TIFFRendererConfigParser; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class TIFFRendererConfigParserTestCase extends AbstractBitmapRendererConfigParserTester { diff --git a/test/java/org/apache/fop/render/bitmap/TIFFRendererConfiguratorTestCase.java b/test/java/org/apache/fop/render/bitmap/TIFFRendererConfiguratorTestCase.java index b5e6318ce..e340830f4 100644 --- a/test/java/org/apache/fop/render/bitmap/TIFFRendererConfiguratorTestCase.java +++ b/test/java/org/apache/fop/render/bitmap/TIFFRendererConfiguratorTestCase.java @@ -23,6 +23,10 @@ import java.awt.image.BufferedImage; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.xmlgraphics.image.writer.Endianness; import org.apache.fop.apps.FopConfBuilder; @@ -32,9 +36,6 @@ import org.apache.fop.render.bitmap.TIFFRendererConfig.TIFFRendererConfigParser; import static org.apache.fop.render.bitmap.TIFFCompressionValue.CCITT_T4; import static org.apache.fop.render.bitmap.TIFFCompressionValue.CCITT_T6; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; public class TIFFRendererConfiguratorTestCase extends AbstractBitmapRendererConfiguratorTest { diff --git a/test/java/org/apache/fop/render/extensions/prepress/PageBoundariesTestCase.java b/test/java/org/apache/fop/render/extensions/prepress/PageBoundariesTestCase.java index 6e48845c1..e3f892e7c 100644 --- a/test/java/org/apache/fop/render/extensions/prepress/PageBoundariesTestCase.java +++ b/test/java/org/apache/fop/render/extensions/prepress/PageBoundariesTestCase.java @@ -19,15 +19,15 @@ package org.apache.fop.render.extensions.prepress; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - import java.awt.Dimension; import java.awt.Rectangle; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; + /** * Tests for the fox:bleed, fox:crop-offset, fox:crop-box extension properties. */ diff --git a/test/java/org/apache/fop/render/extensions/prepress/PageScaleTestCase.java b/test/java/org/apache/fop/render/extensions/prepress/PageScaleTestCase.java index ff07e63ce..9de045cf7 100644 --- a/test/java/org/apache/fop/render/extensions/prepress/PageScaleTestCase.java +++ b/test/java/org/apache/fop/render/extensions/prepress/PageScaleTestCase.java @@ -19,14 +19,14 @@ package org.apache.fop.render.extensions.prepress; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; - import java.awt.geom.Point2D; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + /** * Tests for the fox:scale extension property. */ diff --git a/test/java/org/apache/fop/render/intermediate/AbstractIFPainterTestCase.java b/test/java/org/apache/fop/render/intermediate/AbstractIFPainterTestCase.java index 592335648..ec0f35737 100644 --- a/test/java/org/apache/fop/render/intermediate/AbstractIFPainterTestCase.java +++ b/test/java/org/apache/fop/render/intermediate/AbstractIFPainterTestCase.java @@ -26,15 +26,15 @@ import org.junit.Before; import org.junit.Test; import org.w3c.dom.Document; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import org.apache.fop.fonts.FontInfo; import org.apache.fop.fonts.FontTriplet; import org.apache.fop.render.RenderingContext; import org.apache.fop.traits.BorderProps; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class AbstractIFPainterTestCase { private AbstractIFPainter<?> sut; @@ -51,7 +51,7 @@ public class AbstractIFPainterTestCase { public void endViewport() throws IFException { } - public void startGroup(AffineTransform transform) throws IFException { + public void startGroup(AffineTransform transform, String layer) throws IFException { } public void endGroup() throws IFException { diff --git a/test/java/org/apache/fop/render/intermediate/ArcToBezierCurveTransformerTestCase.java b/test/java/org/apache/fop/render/intermediate/ArcToBezierCurveTransformerTestCase.java index 61093c629..039ddcf90 100644 --- a/test/java/org/apache/fop/render/intermediate/ArcToBezierCurveTransformerTestCase.java +++ b/test/java/org/apache/fop/render/intermediate/ArcToBezierCurveTransformerTestCase.java @@ -76,4 +76,4 @@ public class ArcToBezierCurveTransformerTestCase { fail("Angle " + angle + " is in (0, " + Math.PI / 2 + ")"); } } -}
\ No newline at end of file +} diff --git a/test/java/org/apache/fop/render/intermediate/BorderPainterTestCase.java b/test/java/org/apache/fop/render/intermediate/BorderPainterTestCase.java index f0e9522d9..4a89b3ac6 100644 --- a/test/java/org/apache/fop/render/intermediate/BorderPainterTestCase.java +++ b/test/java/org/apache/fop/render/intermediate/BorderPainterTestCase.java @@ -575,4 +575,4 @@ public class BorderPainterTestCase { } -}
\ No newline at end of file +} diff --git a/test/java/org/apache/fop/render/intermediate/IFStructureTreeBuilderTestCase.java b/test/java/org/apache/fop/render/intermediate/IFStructureTreeBuilderTestCase.java index 4df3fe278..5546e5905 100644 --- a/test/java/org/apache/fop/render/intermediate/IFStructureTreeBuilderTestCase.java +++ b/test/java/org/apache/fop/render/intermediate/IFStructureTreeBuilderTestCase.java @@ -19,14 +19,6 @@ package org.apache.fop.render.intermediate; -import static org.junit.Assert.fail; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.argThat; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentMatcher; @@ -36,6 +28,14 @@ import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.argThat; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + import org.apache.fop.fo.FOElementMapping; import org.apache.fop.fo.extensions.ExtensionElementMapping; import org.apache.fop.fo.extensions.InternalElementMapping; diff --git a/test/java/org/apache/fop/render/intermediate/SAXEventRecorderTestCase.java b/test/java/org/apache/fop/render/intermediate/SAXEventRecorderTestCase.java index c5aad66d0..757d6620b 100644 --- a/test/java/org/apache/fop/render/intermediate/SAXEventRecorderTestCase.java +++ b/test/java/org/apache/fop/render/intermediate/SAXEventRecorderTestCase.java @@ -20,10 +20,6 @@ package org.apache.fop.render.intermediate; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - import org.junit.Before; import org.junit.Test; import org.mockito.InOrder; @@ -32,6 +28,10 @@ import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + import org.apache.fop.render.intermediate.IFStructureTreeBuilder.SAXEventRecorder; import org.apache.fop.util.XMLUtil; diff --git a/test/java/org/apache/fop/render/java2d/Java2DRendererConfigParserTestcase.java b/test/java/org/apache/fop/render/java2d/Java2DRendererConfigParserTestcase.java index 00631af4b..e87c8713d 100644 --- a/test/java/org/apache/fop/render/java2d/Java2DRendererConfigParserTestcase.java +++ b/test/java/org/apache/fop/render/java2d/Java2DRendererConfigParserTestcase.java @@ -21,17 +21,14 @@ package org.apache.fop.render.java2d; import org.junit.Test; -import org.apache.avalon.framework.configuration.Configuration; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import org.apache.fop.apps.AbstractRendererConfigParserTester; -import org.apache.fop.apps.FOPException; import org.apache.fop.apps.Java2DRendererConfBuilder; import org.apache.fop.render.java2d.Java2DRendererConfig.Java2DRendererConfigParser; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - public class Java2DRendererConfigParserTestcase extends AbstractRendererConfigParserTester<Java2DRendererConfBuilder, Java2DRendererConfig> { diff --git a/test/java/org/apache/fop/render/pcl/PCLRendererConfigParserTestCase.java b/test/java/org/apache/fop/render/pcl/PCLRendererConfigParserTestCase.java index 113c3e2bd..caf534854 100644 --- a/test/java/org/apache/fop/render/pcl/PCLRendererConfigParserTestCase.java +++ b/test/java/org/apache/fop/render/pcl/PCLRendererConfigParserTestCase.java @@ -21,13 +21,13 @@ package org.apache.fop.render.pcl; import org.junit.Test; +import static org.junit.Assert.assertEquals; + import org.apache.fop.apps.AbstractRendererConfigParserTester; import org.apache.fop.apps.FOPException; import org.apache.fop.apps.MimeConstants; import org.apache.fop.render.pcl.PCLRendererConfig.PCLRendererConfigParser; -import static org.junit.Assert.assertEquals; - public class PCLRendererConfigParserTestCase extends AbstractRendererConfigParserTester<PCLRendererConfBuilder, PCLRendererConfig> { diff --git a/test/java/org/apache/fop/render/pcl/PCLRendererConfiguratorTestCase.java b/test/java/org/apache/fop/render/pcl/PCLRendererConfiguratorTestCase.java index 024104179..fc7175ad6 100644 --- a/test/java/org/apache/fop/render/pcl/PCLRendererConfiguratorTestCase.java +++ b/test/java/org/apache/fop/render/pcl/PCLRendererConfiguratorTestCase.java @@ -19,16 +19,16 @@ package org.apache.fop.render.pcl; import org.junit.Test; -import org.apache.fop.apps.AbstractRendererConfiguratorTest; -import org.apache.fop.apps.FOPException; -import org.apache.fop.apps.MimeConstants; -import org.apache.fop.render.pcl.PCLRendererConfig.PCLRendererConfigParser; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.when; +import org.apache.fop.apps.AbstractRendererConfiguratorTest; +import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.MimeConstants; +import org.apache.fop.render.pcl.PCLRendererConfig.PCLRendererConfigParser; + public class PCLRendererConfiguratorTestCase extends AbstractRendererConfiguratorTest<PCLRendererConfigurator, PCLRendererConfBuilder> { diff --git a/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java b/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java index 94c842e68..6aad0320e 100644 --- a/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java +++ b/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java @@ -25,11 +25,11 @@ import java.io.IOException; import org.junit.Test; import org.xml.sax.SAXException; +import static org.junit.Assert.fail; + import org.apache.fop.apps.FOUserAgent; import org.apache.fop.pdf.PDFConformanceException; -import static org.junit.Assert.fail; - /** * Tests PDF/A-1 functionality. */ diff --git a/test/java/org/apache/fop/render/pdf/PDFAMetadataTestCase.java b/test/java/org/apache/fop/render/pdf/PDFAMetadataTestCase.java index 1606bf073..6ff40b3c3 100644 --- a/test/java/org/apache/fop/render/pdf/PDFAMetadataTestCase.java +++ b/test/java/org/apache/fop/render/pdf/PDFAMetadataTestCase.java @@ -19,15 +19,14 @@ package org.apache.fop.render.pdf; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - import java.util.Calendar; import java.util.TimeZone; -import org.apache.fop.pdf.PDFDocument; -import org.apache.fop.pdf.PDFInfo; -import org.apache.fop.pdf.PDFMetadata; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + import org.apache.xmlgraphics.xmp.Metadata; import org.apache.xmlgraphics.xmp.schemas.DublinCoreAdapter; import org.apache.xmlgraphics.xmp.schemas.DublinCoreSchema; @@ -35,7 +34,10 @@ import org.apache.xmlgraphics.xmp.schemas.XMPBasicAdapter; import org.apache.xmlgraphics.xmp.schemas.XMPBasicSchema; import org.apache.xmlgraphics.xmp.schemas.pdf.AdobePDFAdapter; import org.apache.xmlgraphics.xmp.schemas.pdf.AdobePDFSchema; -import org.junit.Test; + +import org.apache.fop.pdf.PDFDocument; +import org.apache.fop.pdf.PDFInfo; +import org.apache.fop.pdf.PDFMetadata; /** * Test case for PDF/A metadata handling. diff --git a/test/java/org/apache/fop/render/pdf/PDFCMapTestCase.java b/test/java/org/apache/fop/render/pdf/PDFCMapTestCase.java index fee2c07aa..bb0f2f92e 100644 --- a/test/java/org/apache/fop/render/pdf/PDFCMapTestCase.java +++ b/test/java/org/apache/fop/render/pdf/PDFCMapTestCase.java @@ -19,13 +19,14 @@ package org.apache.fop.render.pdf; -import static org.junit.Assert.assertEquals; - import java.io.StringWriter; -import org.apache.fop.pdf.CMapBuilder; import org.junit.Test; +import static org.junit.Assert.assertEquals; + +import org.apache.fop.pdf.CMapBuilder; + /** Simple sanity test of the PDFCmap class */ public class PDFCMapTestCase { private static final String EOL = "\n"; @@ -60,8 +61,7 @@ public class PDFCMapTestCase { + "end" + EOL + "end" + EOL + "%%EndResource" + EOL - + "%%EOF" + EOL - ; + + "%%EOF" + EOL; final StringWriter w = new StringWriter(); final CMapBuilder builder = new CMapBuilder(w, "test"); diff --git a/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java b/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java index 34647818a..fc6212dcd 100644 --- a/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java +++ b/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java @@ -19,9 +19,6 @@ package org.apache.fop.render.pdf; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import java.io.File; import java.io.IOException; import java.util.StringTokenizer; @@ -30,6 +27,9 @@ import org.junit.Ignore; import org.junit.Test; import org.xml.sax.SAXException; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.apache.fop.apps.FOUserAgent; /** Test that characters are correctly encoded in a generated PDF file */ diff --git a/test/java/org/apache/fop/render/pdf/PDFGraphicsPainterTestCase.java b/test/java/org/apache/fop/render/pdf/PDFGraphicsPainterTestCase.java index 4f3a5e628..3130a73e7 100644 --- a/test/java/org/apache/fop/render/pdf/PDFGraphicsPainterTestCase.java +++ b/test/java/org/apache/fop/render/pdf/PDFGraphicsPainterTestCase.java @@ -24,12 +24,12 @@ import java.io.IOException; import org.junit.Before; import org.junit.Test; -import org.apache.fop.pdf.PDFNumber; - import static org.mockito.Matchers.endsWith; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; +import org.apache.fop.pdf.PDFNumber; + public class PDFGraphicsPainterTestCase { private PDFGraphicsPainter sut; diff --git a/test/java/org/apache/fop/render/pdf/PDFPainterTestCase.java b/test/java/org/apache/fop/render/pdf/PDFPainterTestCase.java index f431b3ee9..db1757847 100644 --- a/test/java/org/apache/fop/render/pdf/PDFPainterTestCase.java +++ b/test/java/org/apache/fop/render/pdf/PDFPainterTestCase.java @@ -24,17 +24,17 @@ import java.awt.Rectangle; import org.junit.Test; -import org.apache.fop.apps.FOUserAgent; -import org.apache.fop.fo.Constants; -import org.apache.fop.render.intermediate.IFContext; -import org.apache.fop.traits.BorderProps; - import static org.mockito.Matchers.endsWith; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.fo.Constants; +import org.apache.fop.render.intermediate.IFContext; +import org.apache.fop.traits.BorderProps; + public class PDFPainterTestCase { @Test diff --git a/test/java/org/apache/fop/render/pdf/PDFRendererConfigParserTestCase.java b/test/java/org/apache/fop/render/pdf/PDFRendererConfigParserTestCase.java index 2d3dfb760..4dd3a6610 100644 --- a/test/java/org/apache/fop/render/pdf/PDFRendererConfigParserTestCase.java +++ b/test/java/org/apache/fop/render/pdf/PDFRendererConfigParserTestCase.java @@ -21,6 +21,10 @@ package org.apache.fop.render.pdf; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import org.apache.fop.apps.AbstractRendererConfigParserTester; import org.apache.fop.apps.PDFRendererConfBuilder; import org.apache.fop.pdf.PDFAMode; @@ -28,10 +32,6 @@ import org.apache.fop.pdf.PDFXMode; import org.apache.fop.pdf.Version; import org.apache.fop.render.pdf.PDFRendererConfig.PDFRendererConfigParser; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class PDFRendererConfigParserTestCase extends AbstractRendererConfigParserTester<PDFRendererConfBuilder, PDFRendererConfig> { diff --git a/test/java/org/apache/fop/render/pdf/PDFRendererOptionsConfigTestCase.java b/test/java/org/apache/fop/render/pdf/PDFRendererOptionsConfigTestCase.java index 489d4dc96..699a8a186 100644 --- a/test/java/org/apache/fop/render/pdf/PDFRendererOptionsConfigTestCase.java +++ b/test/java/org/apache/fop/render/pdf/PDFRendererOptionsConfigTestCase.java @@ -29,6 +29,8 @@ import java.util.Map; import org.junit.Test; +import static org.junit.Assert.assertEquals; + import org.apache.fop.pdf.PDFAMode; import org.apache.fop.pdf.PDFEncryptionParams; import org.apache.fop.pdf.PDFXMode; @@ -40,7 +42,6 @@ import static org.apache.fop.render.pdf.PDFRendererOption.OUTPUT_PROFILE; import static org.apache.fop.render.pdf.PDFRendererOption.PDF_A_MODE; import static org.apache.fop.render.pdf.PDFRendererOption.PDF_X_MODE; import static org.apache.fop.render.pdf.PDFRendererOption.VERSION; -import static org.junit.Assert.assertEquals; public class PDFRendererOptionsConfigTestCase { @@ -51,7 +52,7 @@ public class PDFRendererOptionsConfigTestCase { static { final EnumMap<PDFRendererOption, Object> props = new EnumMap<PDFRendererOption, Object>(PDFRendererOption.class); - for(PDFRendererOption option : PDFRendererOption.values()) { + for (PDFRendererOption option : PDFRendererOption.values()) { props.put(option, option.getDefaultValue()); } DEFAULT_OPTIONS = Collections.unmodifiableMap(props); @@ -102,7 +103,7 @@ public class PDFRendererOptionsConfigTestCase { assertEncryptionParamsEquals(expectedEncryptionParams, actual.getEncryptionParameters()); } - private static void assertEncryptionParamsEquals(PDFEncryptionParams expected, + private static void assertEncryptionParamsEquals(PDFEncryptionParams expected, PDFEncryptionParams actual) { assertEquals(expected == null, actual == null); if (actual != null) { diff --git a/test/java/org/apache/fop/render/pdf/PDFsRGBSettingsTestCase.java b/test/java/org/apache/fop/render/pdf/PDFsRGBSettingsTestCase.java index d084aa618..965a8e30e 100644 --- a/test/java/org/apache/fop/render/pdf/PDFsRGBSettingsTestCase.java +++ b/test/java/org/apache/fop/render/pdf/PDFsRGBSettingsTestCase.java @@ -19,14 +19,14 @@ package org.apache.fop.render.pdf; -import static org.junit.Assert.fail; - import java.io.File; import java.io.IOException; import org.junit.Test; import org.xml.sax.SAXException; +import static org.junit.Assert.fail; + import org.apache.fop.apps.FOUserAgent; /** diff --git a/test/java/org/apache/fop/render/pdf/RenderPDFTestSuite.java b/test/java/org/apache/fop/render/pdf/RenderPDFTestSuite.java index f41520bf3..e74251be1 100644 --- a/test/java/org/apache/fop/render/pdf/RenderPDFTestSuite.java +++ b/test/java/org/apache/fop/render/pdf/RenderPDFTestSuite.java @@ -28,8 +28,6 @@ import org.junit.runners.Suite.SuiteClasses; * A test suite for org.apache.fop.render.pdf.* */ @RunWith(Suite.class) -@SuiteClasses({ - PDFRendererConfigParserTestCase.class -}) +@SuiteClasses(PDFRendererConfigParserTestCase.class) public final class RenderPDFTestSuite { } diff --git a/test/java/org/apache/fop/render/ps/AbstractPostScriptTest.java b/test/java/org/apache/fop/render/ps/AbstractPostScriptTest.java index dcbc2d757..eb25c3f94 100644 --- a/test/java/org/apache/fop/render/ps/AbstractPostScriptTest.java +++ b/test/java/org/apache/fop/render/ps/AbstractPostScriptTest.java @@ -19,11 +19,11 @@ package org.apache.fop.render.ps; -import static org.junit.Assert.assertEquals; - import java.io.File; import java.io.IOException; +import static org.junit.Assert.assertEquals; + import org.apache.xmlgraphics.ps.PSResource; import org.apache.xmlgraphics.ps.dsc.DSCException; import org.apache.xmlgraphics.ps.dsc.DSCParser; diff --git a/test/java/org/apache/fop/render/ps/ImageEncoderPNGTestCase.java b/test/java/org/apache/fop/render/ps/ImageEncoderPNGTestCase.java index 458033dad..53654d76a 100644 --- a/test/java/org/apache/fop/render/ps/ImageEncoderPNGTestCase.java +++ b/test/java/org/apache/fop/render/ps/ImageEncoderPNGTestCase.java @@ -27,17 +27,16 @@ import java.io.IOException; import org.junit.Test; -import org.apache.xmlgraphics.image.loader.ImageSize; -import org.apache.xmlgraphics.image.loader.impl.ImageRawPNG; - -import org.apache.fop.render.RawPNGTestUtil; - import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; - import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import org.apache.xmlgraphics.image.loader.ImageSize; +import org.apache.xmlgraphics.image.loader.impl.ImageRawPNG; + +import org.apache.fop.render.RawPNGTestUtil; + public class ImageEncoderPNGTestCase { @Test diff --git a/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java b/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java index ba0598b52..02e96806f 100644 --- a/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java +++ b/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java @@ -18,15 +18,15 @@ /* $Id$ */ package org.apache.fop.render.ps; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import java.io.File; import java.io.IOException; import java.io.InputStream; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.apache.commons.io.IOUtils; import org.apache.xmlgraphics.ps.DSCConstants; diff --git a/test/java/org/apache/fop/render/ps/PSPainterTestCase.java b/test/java/org/apache/fop/render/ps/PSPainterTestCase.java index 79e5bd9b6..b678fdb4b 100644 --- a/test/java/org/apache/fop/render/ps/PSPainterTestCase.java +++ b/test/java/org/apache/fop/render/ps/PSPainterTestCase.java @@ -146,11 +146,11 @@ public class PSPainterTestCase { int y = 100000; int letterSpacing = 0; int wordSpacing = 0; - int dp[][] = {{100, 100, 0, 0}, null, null, {200, 200, -100, -100}}; - double X = (x + dp[0][0]) / 1000.0; - double Y = (y - dp[0][1]) / 1000.0; - when(psGenerator.formatDouble(X)).thenReturn("100.100"); - when(psGenerator.formatDouble(Y)).thenReturn("99.900"); + int[][] dp = {{100, 100, 0, 0}, null, null, {200, 200, -100, -100}}; + double xAsDouble = (x + dp[0][0]) / 1000.0; + double yAsDouble = (y - dp[0][1]) / 1000.0; + when(psGenerator.formatDouble(xAsDouble)).thenReturn("100.100"); + when(psGenerator.formatDouble(yAsDouble)).thenReturn("99.900"); String text = "Hello Mock!"; try { psPainter.drawText(x, y, letterSpacing, wordSpacing, dp, text); diff --git a/test/java/org/apache/fop/render/ps/PSRendererConfigParserTestCase.java b/test/java/org/apache/fop/render/ps/PSRendererConfigParserTestCase.java index fe59143b4..45642764c 100644 --- a/test/java/org/apache/fop/render/ps/PSRendererConfigParserTestCase.java +++ b/test/java/org/apache/fop/render/ps/PSRendererConfigParserTestCase.java @@ -21,14 +21,14 @@ package org.apache.fop.render.ps; import org.junit.Test; +import static org.junit.Assert.assertEquals; + import org.apache.xmlgraphics.ps.PSGenerator; import org.apache.fop.apps.AbstractRendererConfigParserTester; import org.apache.fop.apps.PSRendererConfBuilder; import org.apache.fop.render.ps.PSRendererConfig.PSRendererConfigParser; -import static org.junit.Assert.assertEquals; - public class PSRendererConfigParserTestCase extends AbstractRendererConfigParserTester<PSRendererConfBuilder, PSRendererConfig> { diff --git a/test/java/org/apache/fop/render/ps/PSRendererConfiguratorTestCase.java b/test/java/org/apache/fop/render/ps/PSRendererConfiguratorTestCase.java index 4d42a0aab..67ba24763 100644 --- a/test/java/org/apache/fop/render/ps/PSRendererConfiguratorTestCase.java +++ b/test/java/org/apache/fop/render/ps/PSRendererConfiguratorTestCase.java @@ -19,16 +19,16 @@ package org.apache.fop.render.ps; import org.junit.Test; -import org.apache.fop.apps.AbstractRendererConfiguratorTest; -import org.apache.fop.apps.MimeConstants; -import org.apache.fop.apps.PSRendererConfBuilder; -import org.apache.fop.render.ps.PSRendererConfig.PSRendererConfigParser; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.when; +import org.apache.fop.apps.AbstractRendererConfiguratorTest; +import org.apache.fop.apps.MimeConstants; +import org.apache.fop.apps.PSRendererConfBuilder; +import org.apache.fop.render.ps.PSRendererConfig.PSRendererConfigParser; + public class PSRendererConfiguratorTestCase extends AbstractRendererConfiguratorTest<PSRendererConfigurator, PSRendererConfBuilder> { private PSRenderingUtil psUtil; diff --git a/test/java/org/apache/fop/render/ps/PSRenderingUtilTestCase.java b/test/java/org/apache/fop/render/ps/PSRenderingUtilTestCase.java index 3f1088fe1..0a2c895be 100644 --- a/test/java/org/apache/fop/render/ps/PSRenderingUtilTestCase.java +++ b/test/java/org/apache/fop/render/ps/PSRenderingUtilTestCase.java @@ -23,13 +23,13 @@ import java.io.IOException; import org.junit.Test; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + import org.apache.xmlgraphics.ps.PSGenerator; import org.apache.fop.render.ps.extensions.PSPageTrailerCodeBefore; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - public class PSRenderingUtilTestCase { private final String content = "<< /MyEntry 0 >> command"; diff --git a/test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java b/test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java index bfdb5f968..4f06938d2 100644 --- a/test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java +++ b/test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java @@ -19,11 +19,6 @@ package org.apache.fop.render.ps; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -33,6 +28,11 @@ import java.util.Set; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + import org.apache.commons.io.IOUtils; import org.apache.xmlgraphics.ps.DSCConstants; diff --git a/test/java/org/apache/fop/render/ps/svg/PSSVGGraphics2DTestCase.java b/test/java/org/apache/fop/render/ps/svg/PSSVGGraphics2DTestCase.java new file mode 100644 index 000000000..29a3a7bd3 --- /dev/null +++ b/test/java/org/apache/fop/render/ps/svg/PSSVGGraphics2DTestCase.java @@ -0,0 +1,71 @@ +/* + * 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.render.ps.svg; + +import java.awt.Color; +import java.awt.geom.AffineTransform; +import java.awt.geom.Rectangle2D; +import java.awt.geom.Rectangle2D.Float; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +import org.apache.commons.io.FileUtils; + +import org.apache.batik.ext.awt.RadialGradientPaint; + +import org.apache.xmlgraphics.java2d.GraphicContext; +import org.apache.xmlgraphics.ps.PSGenerator; + +public class PSSVGGraphics2DTestCase { + + float cx = 841.891f; + float cy = 178.583f; + float r = 16.4331f; + float[] fractions = {0.2f, 0.6012f, 0.8094f, 1.0f}; + + /** + * Tests a radial gradient generated pattern with certain inputs against + * an expected output. + * @throws IOException + */ + @Test + public void testApplyPaint() throws IOException { + ByteArrayOutputStream os = new ByteArrayOutputStream(); + PSGenerator gen = new PSGenerator(os); + PSSVGGraphics2D svgGraphics2D = new PSSVGGraphics2D(false, gen); + svgGraphics2D.setGraphicContext(new GraphicContext()); + svgGraphics2D.setTransform(new AffineTransform()); + Color[] colors = {new Color(255, 255, 255), new Color(200, 200, 200), + new Color(170, 170, 170), new Color(140, 140, 140)}; + RadialGradientPaint paint = new RadialGradientPaint(cx, cy, r, fractions, colors); + Float s = new Rectangle2D.Float(7.0f, 3.0f, 841.891f, 178.583f); + svgGraphics2D.applyPaint(paint, true); + byte[] test = os.toByteArray(); + + byte[] expected = FileUtils.readFileToByteArray( + new File("test/java/org/apache/fop/render/ps/svg/expected.ps")); + assertEquals(new String(test), new String(expected)); + } +} diff --git a/test/java/org/apache/fop/render/ps/svg/PSSVGLinearGraphics2DTestCase.java b/test/java/org/apache/fop/render/ps/svg/PSSVGLinearGraphics2DTestCase.java new file mode 100644 index 000000000..3a6db4396 --- /dev/null +++ b/test/java/org/apache/fop/render/ps/svg/PSSVGLinearGraphics2DTestCase.java @@ -0,0 +1,70 @@ + /* + * 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.render.ps.svg; + +import java.awt.Color; +import java.awt.geom.AffineTransform; +import java.awt.geom.Rectangle2D; +import java.awt.geom.Rectangle2D.Float; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +import org.apache.commons.io.FileUtils; + +import org.apache.batik.ext.awt.LinearGradientPaint; + +import org.apache.xmlgraphics.java2d.GraphicContext; +import org.apache.xmlgraphics.ps.PSGenerator; + +public class PSSVGLinearGraphics2DTestCase { + float startX = 115f; + float endX = 15f; + float startY = 285f; + float endY = 15f; + float[] fractions = {0.0f, 1.0f}; + + /** + * Tests a linear gradient generated pattern with certain inputs against + * an expected output. + * @throws IOException + */ + @Test + public void testApplyPaint() throws IOException { + ByteArrayOutputStream os = new ByteArrayOutputStream(); + PSGenerator gen = new PSGenerator(os); + PSSVGGraphics2D svgGraphics2D = new PSSVGGraphics2D(false, gen); + svgGraphics2D.setGraphicContext(new GraphicContext()); + svgGraphics2D.setTransform(new AffineTransform()); + Color[] colors = {new Color(255, 255, 0), new Color(255, 0, 0)}; + LinearGradientPaint paint = new LinearGradientPaint(startX, startY, endX, endY, fractions, colors); + Float s = new Rectangle2D.Float(115.0f, 15.0f, 170f, 110f); + svgGraphics2D.applyPaint(paint, true); + byte[] test = os.toByteArray(); + + byte[] expected = FileUtils.readFileToByteArray( + new File("test/java/org/apache/fop/render/ps/svg/axial-shading-expected.dat")); + assertEquals(new String(test), new String(expected)); + } +} diff --git a/test/java/org/apache/fop/render/ps/svg/axial-shading-expected.dat b/test/java/org/apache/fop/render/ps/svg/axial-shading-expected.dat new file mode 100644 index 000000000..fdf92cda5 --- /dev/null +++ b/test/java/org/apache/fop/render/ps/svg/axial-shading-expected.dat @@ -0,0 +1,26 @@ +/Pattern setcolorspace +<< +/Type /Pattern +/PatternType 2 +/Shading << +/ShadingType 2 +/ColorSpace /DeviceRGB + /Coords [ 115 285 15 15 ] + /Domain [ 0 1 ] + /Extend [ true true ] + /Function << +/FunctionType 3 +/Domain [ 0 1 ] +/Functions [ << +/FunctionType 2 +/Domain [ 0 1 ] +/C0 [ 1 1 0 ] +/C1 [ 1 0 0 ] +/N 1 +>> ] +/Encode [ 0 1 ] +/Bounds [ ] +>> +>> +>> +matrix makepattern setcolor diff --git a/test/java/org/apache/fop/render/ps/svg/expected.ps b/test/java/org/apache/fop/render/ps/svg/expected.ps new file mode 100644 index 000000000..9977070c3 --- /dev/null +++ b/test/java/org/apache/fop/render/ps/svg/expected.ps @@ -0,0 +1,38 @@ +/Pattern setcolorspace +<< +/Type /Pattern +/PatternType 2 +/Shading << +/ShadingType 3 +/ColorSpace /DeviceRGB + /Coords [ 841.890991 178.582993 3.28662 841.890991 178.582993 16.4331 ] + /Domain [ 0 1 ] + /Extend [ true true ] + /Function << +/FunctionType 3 +/Domain [ 0 1 ] +/Functions [ << +/FunctionType 2 +/Domain [ 0 1 ] +/C0 [ 1 1 1 ] +/C1 [ 0.784314 0.784314 0.784314 ] +/N 1 +>> << +/FunctionType 2 +/Domain [ 0 1 ] +/C0 [ 0.784314 0.784314 0.784314 ] +/C1 [ 0.666667 0.666667 0.666667 ] +/N 1 +>> << +/FunctionType 2 +/Domain [ 0 1 ] +/C0 [ 0.666667 0.666667 0.666667 ] +/C1 [ 0.54902 0.54902 0.54902 ] +/N 1 +>> ] +/Encode [ 0 1 0 1 0 1 ] +/Bounds [ 0.6012 0.8094 ] +>> +>> +>> +matrix makepattern setcolor diff --git a/test/java/org/apache/fop/render/rtf/Bug39607TestCase.java b/test/java/org/apache/fop/render/rtf/Bug39607TestCase.java index c5821fff1..4c3c8446e 100644 --- a/test/java/org/apache/fop/render/rtf/Bug39607TestCase.java +++ b/test/java/org/apache/fop/render/rtf/Bug39607TestCase.java @@ -21,13 +21,14 @@ package org.apache.fop.render.rtf; import java.io.StringWriter; +import org.junit.Test; + import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfFile; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow; -import org.junit.Test; /** * Test for http://issues.apache.org/bugzilla/show_bug.cgi?id=39607 diff --git a/test/java/org/apache/fop/render/rtf/RichTextFormatTestSuite.java b/test/java/org/apache/fop/render/rtf/RichTextFormatTestSuite.java index d8296fc33..5b294bd9b 100644 --- a/test/java/org/apache/fop/render/rtf/RichTextFormatTestSuite.java +++ b/test/java/org/apache/fop/render/rtf/RichTextFormatTestSuite.java @@ -27,6 +27,6 @@ import org.junit.runners.Suite.SuiteClasses; * Test suite for FOP's RTF library. */ @RunWith(Suite.class) -@SuiteClasses({ Bug39607TestCase.class }) +@SuiteClasses(Bug39607TestCase.class) public class RichTextFormatTestSuite { } diff --git a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/BasicLink.java b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/BasicLink.java index 07085059d..9df1c26ef 100644 --- a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/BasicLink.java +++ b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/BasicLink.java @@ -27,17 +27,15 @@ package org.apache.fop.render.rtf.rtflib.testdocs; +import java.io.IOException; + import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; -import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; -import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfHyperLink; - -import java.io.IOException; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; /** * Class <code>BasicLink</code> here. - * - * @author <a href="mailto:mks@ANDREAS">Andreas Putz</a> */ public class BasicLink extends TestDocument { diff --git a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/CreateTestDocuments.java b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/CreateTestDocuments.java index 16460cd1c..7f17514ef 100644 --- a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/CreateTestDocuments.java +++ b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/CreateTestDocuments.java @@ -29,11 +29,8 @@ package org.apache.fop.render.rtf.rtflib.testdocs; import java.io.File; import java.io.IOException; -//import org.apache.fop.render.rtf.rtflib.jfor.main.JForVersionInfo; /** Create test RTF documents from classes found in this package. - * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch - * @author Andreas Putz a.putz@skynamics.com */ public class CreateTestDocuments { diff --git a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/DummyTableColumnsInfo.java b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/DummyTableColumnsInfo.java index 3329b26b9..1af4c7bed 100644 --- a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/DummyTableColumnsInfo.java +++ b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/DummyTableColumnsInfo.java @@ -33,8 +33,6 @@ import org.apache.fop.render.rtf.rtflib.rtfdoc.ITableColumnsInfo; * to create documents without worrying about nested tables handling. * Might need to be replaced by more complete version in some sample * documents created by this package. - * - * @author bdelacretaz@codeconsult.ch */ class DummyTableColumnsInfo implements ITableColumnsInfo { diff --git a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/ExternalGraphic.java b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/ExternalGraphic.java index b957bc1fa..1127f3e72 100644 --- a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/ExternalGraphic.java +++ b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/ExternalGraphic.java @@ -27,16 +27,14 @@ package org.apache.fop.render.rtf.rtflib.testdocs; +import java.io.IOException; + import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; -import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfExternalGraphic; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; - -import java.io.IOException; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; /** * Generate a test document containing external graphics. - * - * @author <a href="mailto:a.putz@skynamics.com">Andreas Putz</a> */ class ExternalGraphic extends TestDocument { private String file = "file:///tmp/jfor-images/logo."; diff --git a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/ListInTable.java b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/ListInTable.java index 3ce05c606..6f4e27a59 100644 --- a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/ListInTable.java +++ b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/ListInTable.java @@ -30,13 +30,13 @@ package org.apache.fop.render.rtf.rtflib.testdocs; import java.io.IOException; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; -import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfList; -import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable; -import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow; -import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableCell; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListItem; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableCell; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow; /** Generates a simple RTF test document for the jfor rtflib package. */ diff --git a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/MergedTableCells.java b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/MergedTableCells.java index f1817bf03..9be5e899a 100644 --- a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/MergedTableCells.java +++ b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/MergedTableCells.java @@ -32,11 +32,10 @@ import java.io.IOException; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable; -import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableCell; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow; /** Generates an RTF test document containing merged table cells - * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch */ class MergedTableCells extends TestDocument { diff --git a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/NestedTable.java b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/NestedTable.java index 72dad7e98..c11fbc334 100644 --- a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/NestedTable.java +++ b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/NestedTable.java @@ -30,14 +30,13 @@ package org.apache.fop.render.rtf.rtflib.testdocs; import java.io.IOException; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable; -import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; -import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableCell; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow; /** Generates an RTF document to test nested tables with the jfor rtflib package. - * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch */ class NestedTable extends TestDocument { diff --git a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/ParagraphAlignment.java b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/ParagraphAlignment.java index 2b38aa789..edce3264a 100644 --- a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/ParagraphAlignment.java +++ b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/ParagraphAlignment.java @@ -27,14 +27,13 @@ package org.apache.fop.render.rtf.rtflib.testdocs; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; -import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfText; -import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes; /** Generates a simple RTF test document for the jfor rtflib package. - * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch */ public class ParagraphAlignment extends TestDocument { diff --git a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleDocument.java b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleDocument.java index 2ca16c0e5..ca6ce79bc 100644 --- a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleDocument.java +++ b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleDocument.java @@ -30,11 +30,10 @@ package org.apache.fop.render.rtf.rtflib.testdocs; import java.io.IOException; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; -import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; /** Generates a simple RTF test document for the jfor rtflib package. - * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch */ class SimpleDocument diff --git a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleLists.java b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleLists.java index eff3aa7ff..e817f6a13 100644 --- a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleLists.java +++ b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleLists.java @@ -30,15 +30,14 @@ package org.apache.fop.render.rtf.rtflib.testdocs; import java.io.IOException; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; -import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfList; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListItem; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyle; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyleNumber; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; /** Generates a simple RTF test document for the jfor rtflib package. - * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch */ class SimpleLists extends TestDocument { diff --git a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleTable.java b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleTable.java index cf84b3ec4..10ddc11e7 100644 --- a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleTable.java +++ b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleTable.java @@ -32,11 +32,10 @@ import java.io.IOException; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable; -import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableCell; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow; /** Generates a simple RTF test document for the jfor rtflib package. - * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch */ class SimpleTable extends TestDocument { /** generate the body of the test document */ diff --git a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/TestDocument.java b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/TestDocument.java index 5274dc32e..266903766 100644 --- a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/TestDocument.java +++ b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/TestDocument.java @@ -27,19 +27,17 @@ package org.apache.fop.render.rtf.rtflib.testdocs; -import java.util.Date; import java.io.File; -import java.io.IOException; import java.io.FileWriter; +import java.io.IOException; +import java.util.Date; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; -import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfFile; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; -//import org.apache.fop.render.rtf.rtflib.jfor.main.JForVersionInfo; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; /** Base class for generating RTF documents used to test the jfor rtflib package. - * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch */ abstract class TestDocument { diff --git a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/TextAttributes.java b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/TextAttributes.java index 4ab48acb0..bb0614cee 100644 --- a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/TextAttributes.java +++ b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/TextAttributes.java @@ -29,14 +29,13 @@ package org.apache.fop.render.rtf.rtflib.testdocs; import java.io.IOException; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; -import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfText; -import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes; /** Generates a simple RTF test document for the jfor rtflib package. - * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch */ class TextAttributes extends TestDocument { diff --git a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/Whitespace.java b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/Whitespace.java index 4359822f6..a206e014f 100644 --- a/test/java/org/apache/fop/render/rtf/rtflib/testdocs/Whitespace.java +++ b/test/java/org/apache/fop/render/rtf/rtflib/testdocs/Whitespace.java @@ -30,11 +30,10 @@ package org.apache.fop.render.rtf.rtflib.testdocs; import java.io.IOException; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; -import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; /** Generates an RTF document to test the WhitespaceCollapser - * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch */ class Whitespace extends TestDocument { diff --git a/test/java/org/apache/fop/render/txt/TxtRendererConfigParserTestCase.java b/test/java/org/apache/fop/render/txt/TxtRendererConfigParserTestCase.java index a7ae52c65..30fed05ea 100644 --- a/test/java/org/apache/fop/render/txt/TxtRendererConfigParserTestCase.java +++ b/test/java/org/apache/fop/render/txt/TxtRendererConfigParserTestCase.java @@ -21,13 +21,12 @@ package org.apache.fop.render.txt; import org.junit.Test; +import static org.junit.Assert.assertEquals; + import org.apache.fop.apps.AbstractRendererConfigParserTester; import org.apache.fop.apps.TxtRendererConfBuilder; -import org.apache.fop.render.RendererConfig.RendererConfigParser; -import org.apache.fop.render.txt.TxtRendererConfig.TxtRendererOption; import org.apache.fop.render.txt.TxtRendererConfig.TxtRendererConfigParser; - -import static org.junit.Assert.assertEquals; +import org.apache.fop.render.txt.TxtRendererConfig.TxtRendererOption; public class TxtRendererConfigParserTestCase extends AbstractRendererConfigParserTester<TxtRendererConfBuilder, TxtRendererConfig> { diff --git a/test/java/org/apache/fop/text/linebreak/LineBreakStatusTestCase.java b/test/java/org/apache/fop/text/linebreak/LineBreakStatusTestCase.java index 42ca8dee6..d8813c3bc 100644 --- a/test/java/org/apache/fop/text/linebreak/LineBreakStatusTestCase.java +++ b/test/java/org/apache/fop/text/linebreak/LineBreakStatusTestCase.java @@ -19,10 +19,10 @@ package org.apache.fop.text.linebreak; -import static org.junit.Assert.assertTrue; - import org.junit.Test; +import static org.junit.Assert.assertTrue; + /** * JUnit test case for the LineBreakStatus class diff --git a/test/java/org/apache/fop/text/linebreak/LineBreakUtilsTestCase.java b/test/java/org/apache/fop/text/linebreak/LineBreakUtilsTestCase.java index 015c1846f..5fc5c7d50 100644 --- a/test/java/org/apache/fop/text/linebreak/LineBreakUtilsTestCase.java +++ b/test/java/org/apache/fop/text/linebreak/LineBreakUtilsTestCase.java @@ -19,10 +19,10 @@ package org.apache.fop.text.linebreak; -import static org.junit.Assert.assertEquals; - import org.junit.Test; +import static org.junit.Assert.assertEquals; + /** * TODO add javadoc * diff --git a/test/java/org/apache/fop/threading/FOProcessorImpl.java b/test/java/org/apache/fop/threading/FOProcessorImpl.java index 04fed19ba..721830aee 100644 --- a/test/java/org/apache/fop/threading/FOProcessorImpl.java +++ b/test/java/org/apache/fop/threading/FOProcessorImpl.java @@ -81,8 +81,8 @@ public class FOProcessorImpl extends AbstractLogEnabled } } - /** {@inheritDoc} - * @throws URISyntaxException + /** {@inheritDoc} + * @throws URISyntaxException * @throws SAXException */ public void process(Source src, Templates templates, OutputStream out) throws java.io.IOException, URISyntaxException, SAXException { diff --git a/test/java/org/apache/fop/threading/Main.java b/test/java/org/apache/fop/threading/Main.java index 7ff0cec4f..d18ae405a 100644 --- a/test/java/org/apache/fop/threading/Main.java +++ b/test/java/org/apache/fop/threading/Main.java @@ -32,7 +32,10 @@ import org.apache.avalon.framework.logger.ConsoleLogger; /** * Starter class for the multi-threading testbed. */ -public class Main { +public final class Main { + + private Main() { + } private static void prompt() throws IOException { BufferedReader in = new BufferedReader(new java.io.InputStreamReader(System.in)); diff --git a/test/java/org/apache/fop/traits/BorderPropsTestCase.java b/test/java/org/apache/fop/traits/BorderPropsTestCase.java index ec93d708e..692e3059f 100644 --- a/test/java/org/apache/fop/traits/BorderPropsTestCase.java +++ b/test/java/org/apache/fop/traits/BorderPropsTestCase.java @@ -23,14 +23,14 @@ import java.awt.Color; import org.junit.Test; +import static org.junit.Assert.assertEquals; + import org.apache.xmlgraphics.java2d.color.ColorWithAlternatives; import org.apache.xmlgraphics.java2d.color.DeviceCMYKColorSpace; import org.apache.fop.fo.Constants; import org.apache.fop.util.ColorUtil; -import static org.junit.Assert.assertEquals; - /** * Tests the BorderProps class. */ @@ -67,7 +67,7 @@ public class BorderPropsTestCase { Color col = new Color(1.0f, 1.0f, 0.5f, 1.0f); //Normalize: Avoid false alarms due to color conversion (rounding) col = ColorUtil.parseColorString(null, ColorUtil.colorToString(col)); - for(BorderProps.Mode mode : BorderProps.Mode.values()) { + for (BorderProps.Mode mode : BorderProps.Mode.values()) { BorderProps sut = BorderProps.makeRectangular(Constants.EN_SOLID, 10, col, mode); testSerialization(sut); sut = new BorderProps(Constants.EN_SOLID, 10, 4, 3, col, mode); diff --git a/test/java/org/apache/fop/traits/MinOptMaxTestCase.java b/test/java/org/apache/fop/traits/MinOptMaxTestCase.java index 73465fdcc..ba6862785 100644 --- a/test/java/org/apache/fop/traits/MinOptMaxTestCase.java +++ b/test/java/org/apache/fop/traits/MinOptMaxTestCase.java @@ -19,13 +19,13 @@ package org.apache.fop.traits; +import org.junit.Test; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import org.junit.Test; - /** * Tests the {@link MinOptMax} class. */ diff --git a/test/java/org/apache/fop/util/AdvancedMessageFormatTestCase.java b/test/java/org/apache/fop/util/AdvancedMessageFormatTestCase.java index c4b9446ac..5e75f2563 100644 --- a/test/java/org/apache/fop/util/AdvancedMessageFormatTestCase.java +++ b/test/java/org/apache/fop/util/AdvancedMessageFormatTestCase.java @@ -19,15 +19,16 @@ package org.apache.fop.util; -import static org.junit.Assert.assertEquals; - import java.util.Map; -import org.apache.fop.events.model.EventSeverity; -import org.apache.fop.util.text.AdvancedMessageFormat; import org.junit.Test; import org.xml.sax.helpers.LocatorImpl; +import static org.junit.Assert.assertEquals; + +import org.apache.fop.events.model.EventSeverity; +import org.apache.fop.util.text.AdvancedMessageFormat; + /** * Tests for EventFormatter. */ diff --git a/test/java/org/apache/fop/util/BitmapImageUtilTestCase.java b/test/java/org/apache/fop/util/BitmapImageUtilTestCase.java index 3afcc3a2e..8bda99785 100644 --- a/test/java/org/apache/fop/util/BitmapImageUtilTestCase.java +++ b/test/java/org/apache/fop/util/BitmapImageUtilTestCase.java @@ -19,8 +19,6 @@ package org.apache.fop.util; -import static org.junit.Assert.assertEquals; - import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; @@ -31,13 +29,18 @@ import java.io.IOException; import java.io.InputStream; import java.io.StringWriter; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + import org.apache.commons.io.IOUtils; -import org.apache.fop.util.bitmap.BitmapImageUtil; -import org.apache.fop.util.bitmap.MonochromeBitmapConverter; + import org.apache.xmlgraphics.image.writer.ImageWriterUtil; import org.apache.xmlgraphics.util.WriterOutputStream; import org.apache.xmlgraphics.util.io.ASCIIHexOutputStream; -import org.junit.Test; + +import org.apache.fop.util.bitmap.BitmapImageUtil; +import org.apache.fop.util.bitmap.MonochromeBitmapConverter; /** * Tests {@link BitmapImageUtil}. diff --git a/test/java/org/apache/fop/util/ColorUtilTestCase.java b/test/java/org/apache/fop/util/ColorUtilTestCase.java index 6e65004a3..c86ebbeac 100644 --- a/test/java/org/apache/fop/util/ColorUtilTestCase.java +++ b/test/java/org/apache/fop/util/ColorUtilTestCase.java @@ -26,6 +26,11 @@ import java.net.URI; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + import org.apache.xmlgraphics.java2d.color.ColorSpaces; import org.apache.xmlgraphics.java2d.color.ColorWithAlternatives; import org.apache.xmlgraphics.java2d.color.NamedColorSpace; @@ -34,11 +39,6 @@ import org.apache.xmlgraphics.java2d.color.RenderingIntent; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.FopFactory; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - /** * Tests the ColorUtil class. */ diff --git a/test/java/org/apache/fop/util/DigestFilter.java b/test/java/org/apache/fop/util/DigestFilter.java index 94e8d67d2..9e62fdc1c 100644 --- a/test/java/org/apache/fop/util/DigestFilter.java +++ b/test/java/org/apache/fop/util/DigestFilter.java @@ -95,9 +95,6 @@ public class DigestFilter extends XMLFilterImpl { super.endDocument(); } - /* (non-Javadoc) - * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes) - */ public void startElement( String url, String localName, diff --git a/test/java/org/apache/fop/util/ElementListUtilsTestCase.java b/test/java/org/apache/fop/util/ElementListUtilsTestCase.java index 342488a93..5e4f38b0b 100644 --- a/test/java/org/apache/fop/util/ElementListUtilsTestCase.java +++ b/test/java/org/apache/fop/util/ElementListUtilsTestCase.java @@ -19,17 +19,18 @@ package org.apache.fop.util; +import java.util.LinkedList; + +import org.junit.Test; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; -import java.util.LinkedList; - import org.apache.fop.layoutmgr.ElementListUtils; import org.apache.fop.layoutmgr.KnuthBox; import org.apache.fop.layoutmgr.KnuthElement; import org.apache.fop.layoutmgr.KnuthGlue; import org.apache.fop.layoutmgr.KnuthPenalty; -import org.junit.Test; /** * Test class for ElementListUtils. diff --git a/test/java/org/apache/fop/util/LanguageTagsTestCase.java b/test/java/org/apache/fop/util/LanguageTagsTestCase.java index f7383c720..91861dcc6 100644 --- a/test/java/org/apache/fop/util/LanguageTagsTestCase.java +++ b/test/java/org/apache/fop/util/LanguageTagsTestCase.java @@ -19,12 +19,12 @@ package org.apache.fop.util; -import static org.junit.Assert.assertEquals; - import java.util.Locale; import org.junit.Test; +import static org.junit.Assert.assertEquals; + /** * Tests {@link LanguageTags}. */ diff --git a/test/java/org/apache/fop/util/XMLResourceBundleTestCase.java b/test/java/org/apache/fop/util/XMLResourceBundleTestCase.java index 26cfa4406..60aa16d83 100644 --- a/test/java/org/apache/fop/util/XMLResourceBundleTestCase.java +++ b/test/java/org/apache/fop/util/XMLResourceBundleTestCase.java @@ -19,15 +19,15 @@ package org.apache.fop.util; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + /** * Tests for XMLResourceBundle. */ diff --git a/test/java/org/apache/fop/visual/BitmapComparator.java b/test/java/org/apache/fop/visual/BitmapComparator.java index e0c1d5bd4..f2157176b 100644 --- a/test/java/org/apache/fop/visual/BitmapComparator.java +++ b/test/java/org/apache/fop/visual/BitmapComparator.java @@ -30,11 +30,12 @@ import java.io.IOException; import java.io.InputStream; import java.net.URL; +import org.apache.commons.io.IOUtils; + import org.apache.batik.ext.awt.image.GraphicsUtil; import org.apache.batik.ext.awt.image.renderable.Filter; import org.apache.batik.ext.awt.image.spi.ImageTagRegistry; import org.apache.batik.util.ParsedURL; -import org.apache.commons.io.IOUtils; /** * Helper class to visually compare two bitmap images. @@ -45,7 +46,11 @@ import org.apache.commons.io.IOUtils; * <p> * TODO Move as utility class to XML Graphics Commons when possible */ -public class BitmapComparator { +public final class BitmapComparator { + + + private BitmapComparator() { + } /** * Builds a new BufferedImage that is the difference between the two input images @@ -79,15 +84,14 @@ public class BitmapComparator { int w = ref.getWidth(); int h = ref.getHeight(); - int y, i, val; int [] refPix = null; int [] genPix = null; - for (y = 0; y < h; y++) { - refPix = refWR.getPixels (0, y, w, 1, refPix); - genPix = genWR.getPixels (0, y, w, 1, genPix); - for (i = 0; i < refPix.length; i++) { + for (int y = 0; y < h; y++) { + refPix = refWR.getPixels(0, y, w, 1, refPix); + genPix = genWR.getPixels(0, y, w, 1, genPix); + for (int i = 0; i < refPix.length; i++) { // val = ((genPix[i] - refPix[i]) * 5) + 128; - val = ((refPix[i] - genPix[i]) * 10) + 128; + int val = ((refPix[i] - genPix[i]) * 10) + 128; if ((val & 0xFFFFFF00) != 0) { if ((val & 0x80000000) != 0) { val = 0; diff --git a/test/java/org/apache/fop/visual/ConvertUtils.java b/test/java/org/apache/fop/visual/ConvertUtils.java index e83322f90..aa4dadf47 100644 --- a/test/java/org/apache/fop/visual/ConvertUtils.java +++ b/test/java/org/apache/fop/visual/ConvertUtils.java @@ -27,7 +27,10 @@ import org.apache.commons.logging.Log; /** * Utilities for converting files with external converters. */ -public class ConvertUtils { +public final class ConvertUtils { + + private ConvertUtils() { + } /** * Calls an external converter application (GhostScript, for example). |