Author: tilman Date: Sat Apr 12 12:58:34 2025 New Revision: 1925045 URL: http://svn.apache.org/viewvc?rev=1925045&view=rev Log: PDFBOX-5660: Sonar fix
Modified: pdfbox/trunk/examples/src/test/java/org/apache/pdfbox/examples/pdfa/CreatePDFATest.java pdfbox/trunk/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/TestCreateSignature.java pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestPublicKeyEncryption.java pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestSymmetricKeyEncryption.java pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PageExtractorTest.java pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/multipdf/TestLayerUtility.java pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdfwriter/COSWriterTest.java pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocument.java pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentInformation.java pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDPageTree.java pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/PDStreamTest.java pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/function/TestPDFunctionType4.java pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/function/type4/TestParser.java pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/PDFontTest.java pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/TestFontEncoding.java pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/optionalcontent/TestOptionalContentGroups.java pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/text/BidiTest.java pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/text/TestTextStripper.java pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/MatrixTest.java pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestDateUtil.java pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/TestExtractText.java pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/imageio/TestImageIOUtils.java pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/DateConverterTest.java pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/DoubleSameTypeSchemaTest.java pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/TestValidatePermitedMetadata.java pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/TestXMPWithDefinedSchemas.java pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/TestXMPWithUndefinedSchemas.java pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/AdobePDFTest.java pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/BasicJobTicketSchemaTest.java pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/DublinCoreTest.java pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PDFAIdentificationOthersTest.java pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PDFAIdentificationTest.java pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PhotoshopSchemaTest.java pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/SchemaTester.java pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/TestExifXmp.java pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPBasicTest.java pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPMediaManagementTest.java pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XmpRightsSchemaTest.java pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestAbstractStructuredType.java pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestDerivedType.java pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestSimpleMetadataProperties.java pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestStructuredType.java Modified: pdfbox/trunk/examples/src/test/java/org/apache/pdfbox/examples/pdfa/CreatePDFATest.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/examples/src/test/java/org/apache/pdfbox/examples/pdfa/CreatePDFATest.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/examples/src/test/java/org/apache/pdfbox/examples/pdfa/CreatePDFATest.java (original) +++ pdfbox/trunk/examples/src/test/java/org/apache/pdfbox/examples/pdfa/CreatePDFATest.java Sat Apr 12 12:58:34 2025 @@ -22,10 +22,13 @@ import static org.junit.jupiter.api.Asse import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; +import java.io.IOException; import java.io.InputStreamReader; +import java.security.GeneralSecurityException; import java.security.KeyStore; import java.util.HashSet; import java.util.Set; +import javax.xml.transform.TransformerException; import org.apache.pdfbox.Loader; import org.apache.pdfbox.examples.pdmodel.CreatePDFA; @@ -35,9 +38,12 @@ import org.apache.pdfbox.pdmodel.PDDocum import org.apache.pdfbox.pdmodel.common.PDMetadata; import org.apache.xmpbox.XMPMetadata; import org.apache.xmpbox.schema.DublinCoreSchema; +import org.apache.xmpbox.type.BadFieldValueException; import org.apache.xmpbox.xml.DomXmpParser; +import org.apache.xmpbox.xml.XmpParsingException; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.verapdf.core.VeraPDFException; import org.verapdf.gf.foundry.VeraGreenfieldFoundryProvider; import org.verapdf.pdfa.Foundries; import org.verapdf.pdfa.PDFAParser; @@ -63,7 +69,8 @@ class CreatePDFATest * Test of doIt method of class CreatePDFA. */ @Test - void testCreatePDFA() throws Exception + void testCreatePDFA() throws IOException, TransformerException, GeneralSecurityException, + XmpParsingException, BadFieldValueException, VeraPDFException { String pdfaFilename = OUTDIR + "/PDFA.pdf"; String signedPdfaFilename = OUTDIR + "/PDFA_signed.pdf"; Modified: pdfbox/trunk/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/TestCreateSignature.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/TestCreateSignature.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/TestCreateSignature.java (original) +++ pdfbox/trunk/examples/src/test/java/org/apache/pdfbox/examples/pdmodel/TestCreateSignature.java Sat Apr 12 12:58:34 2025 @@ -162,7 +162,7 @@ class TestCreateSignature } @BeforeAll - static void init() throws Exception + static void init() throws IOException, GeneralSecurityException { Security.addProvider(SecurityProvider.getProvider()); certificateFactory = CertificateFactory.getInstance("X.509"); Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestPublicKeyEncryption.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestPublicKeyEncryption.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestPublicKeyEncryption.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestPublicKeyEncryption.java Sat Apr 12 12:58:34 2025 @@ -148,7 +148,7 @@ class TestPublicKeyEncryption * {@inheritDoc} */ @AfterEach - void tearDown() throws Exception + void tearDown() throws IOException { document.close(); } Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestSymmetricKeyEncryption.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestSymmetricKeyEncryption.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestSymmetricKeyEncryption.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/encryption/TestSymmetricKeyEncryption.java Sat Apr 12 12:58:34 2025 @@ -205,10 +205,10 @@ class TestSymmetricKeyEncryption /** * Protect a document with a key and try to reopen it with that key and compare. * - * @throws Exception If there is an unexpected error during the test. + * @throws IOException If there is an unexpected error during the test. */ @Test - void testProtection() throws Exception + void testProtection() throws IOException { String filename = "Acroform-PDFBOX-2333.pdf"; byte[] inputFileAsByteArray = getFileResourceAsByteArray(filename); Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PageExtractorTest.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PageExtractorTest.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== Binary files - no diff available. Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/multipdf/TestLayerUtility.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/multipdf/TestLayerUtility.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/multipdf/TestLayerUtility.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/multipdf/TestLayerUtility.java Sat Apr 12 12:58:34 2025 @@ -61,7 +61,7 @@ class TestLayerUtility /** * Tests layer import. - * @throws Exception if an error occurs + * @throws IOException if an error occurs */ @Test void testLayerImport() throws IOException Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdfwriter/COSWriterTest.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdfwriter/COSWriterTest.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdfwriter/COSWriterTest.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdfwriter/COSWriterTest.java Sat Apr 12 12:58:34 2025 @@ -70,7 +70,7 @@ class COSWriterTest } @Test - void testPDFBox5485() throws Exception + void testPDFBox5485() throws IOException { File pdfFile = Paths.get("src", "test", "resources", "input", "PDFBOX-3110-poems-beads.pdf") .toFile(); @@ -85,7 +85,7 @@ class COSWriterTest } @Test - void testPDFBox5945() throws Exception + void testPDFBox5945() throws IOException { byte[] input = create(); checkTrailerSize(input); Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocument.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocument.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocument.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocument.java Sat Apr 12 12:58:34 2025 @@ -46,7 +46,7 @@ class TestPDDocument private static final File TESTRESULTSDIR = new File("target/test-output"); @BeforeAll - static void setUp() throws Exception + static void setUp() { TESTRESULTSDIR.mkdirs(); } Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentInformation.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentInformation.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentInformation.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentInformation.java Sat Apr 12 12:58:34 2025 @@ -22,6 +22,7 @@ import static org.junit.jupiter.api.Asse import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; +import java.io.IOException; import java.util.Arrays; import java.util.List; @@ -38,7 +39,7 @@ class TestPDDocumentInformation { @Test - void testMetadataExtraction() throws Exception + void testMetadataExtraction() throws IOException { // This document has been selected for this test as it contains custom metadata. try (PDDocument doc = Loader.loadPDF(new File("src/test/resources/input/hello3.pdf"))) @@ -73,10 +74,10 @@ class TestPDDocumentInformation /** * PDFBOX-3068: test that indirect /Title element of /Info entry can be found. * - * @throws Exception + * @throws IOException */ @Test - void testPDFBox3068() throws Exception + void testPDFBox3068() throws IOException { try (PDDocument doc = Loader.loadPDF(RandomAccessReadBuffer.createBufferFromStream( TestPDDocumentInformation.class.getResourceAsStream("PDFBOX-3068.pdf")))) Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDPageTree.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDPageTree.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDPageTree.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDPageTree.java Sat Apr 12 12:58:34 2025 @@ -91,9 +91,10 @@ class TestPDPageTree } @Test - void testInsertBeforeBlankPage() throws Exception + void testInsertBeforeBlankPage() throws IOException { - try (PDDocument document = new PDDocument()) { + try (PDDocument document = new PDDocument()) + { PDPage pageOne = new PDPage(); PDPage pageTwo = new PDPage(); PDPage pageThree = new PDPage(); @@ -110,9 +111,10 @@ class TestPDPageTree } @Test - void testInsertAfterBlankPage() throws Exception + void testInsertAfterBlankPage() throws IOException { - try (PDDocument document = new PDDocument()) { + try (PDDocument document = new PDDocument()) + { PDPage pageOne = new PDPage(); PDPage pageTwo = new PDPage(); PDPage pageThree = new PDPage(); Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/PDStreamTest.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/PDStreamTest.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/PDStreamTest.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/PDStreamTest.java Sat Apr 12 12:58:34 2025 @@ -19,6 +19,7 @@ import static org.junit.jupiter.api.Asse import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.ByteArrayInputStream; +import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; @@ -38,7 +39,7 @@ class PDStreamTest * Test for null filter list (PDFBOX-2948) */ @Test - void testCreateInputStreamNullFilters() throws Exception + void testCreateInputStreamNullFilters() throws IOException { try (PDDocument doc = new PDDocument()) { @@ -62,7 +63,7 @@ class PDStreamTest * Test for empty filter list */ @Test - void testCreateInputStreamEmptyFilters() throws Exception + void testCreateInputStreamEmptyFilters() throws IOException { try (PDDocument doc = new PDDocument()) { @@ -86,7 +87,7 @@ class PDStreamTest * Test for null stop filters */ @Test - void testCreateInputStreamNullStopFilters() throws Exception + void testCreateInputStreamNullStopFilters() throws IOException { try (PDDocument doc = new PDDocument()) { Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/function/TestPDFunctionType4.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/function/TestPDFunctionType4.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/function/TestPDFunctionType4.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/function/TestPDFunctionType4.java Sat Apr 12 12:58:34 2025 @@ -54,10 +54,10 @@ class TestPDFunctionType4 /** * Checks the {@link PDFunctionType4}. - * @throws Exception if an error occurs + * @throws IOException if an error occurs */ @Test - void testFunctionSimple() throws Exception + void testFunctionSimple() throws IOException { String functionText = "{ add }"; //Simply adds the two arguments and returns the result @@ -87,10 +87,10 @@ class TestPDFunctionType4 /** * Checks the handling of the argument order for a {@link PDFunctionType4}. - * @throws Exception if an error occurs + * @throws IOException if an error occurs */ @Test - void testFunctionArgumentOrder() throws Exception + void testFunctionArgumentOrder() throws IOException { String functionText = "{ pop }"; // pops an argument (2nd) and returns the next argument (1st) Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/function/type4/TestParser.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/function/type4/TestParser.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/function/type4/TestParser.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/function/type4/TestParser.java Sat Apr 12 12:58:34 2025 @@ -32,10 +32,9 @@ class TestParser /** * Test the very basics. - * @throws Exception if an error occurs */ @Test - void testParserBasics() throws Exception + void testParserBasics() { Type4Tester.create("3 4 add 2 sub").pop(5).isEmpty(); } @@ -45,7 +44,7 @@ class TestParser * @throws Exception if an error occurs */ @Test - void testNested() throws Exception + void testNested() { Type4Tester.create("true { 2 1 add } { 2 1 sub } ifelse") .pop(3).isEmpty(); @@ -55,10 +54,9 @@ class TestParser /** * Tests parsing of real values. - * @throws Exception if an error occurs */ @Test - void testParseFloat() throws Exception + void testParseFloat() { assertEquals(0, InstructionSequenceBuilder.parseReal("0"), 0.00001f); assertEquals(1, InstructionSequenceBuilder.parseReal("1"), 0.00001f); @@ -72,10 +70,9 @@ class TestParser /** * Tests problematic functions from PDFBOX-804. - * @throws Exception if an error occurs */ @Test - void testJira804() throws Exception + void testJira804() { //This is an example of a tint to CMYK function //Problems here were: Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/PDFontTest.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/PDFontTest.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/PDFontTest.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/PDFontTest.java Sat Apr 12 12:58:34 2025 @@ -70,7 +70,7 @@ class PDFontTest private static final File OUT_DIR = new File("target/test-output"); @BeforeAll - static void setUp() throws Exception + static void setUp() { OUT_DIR.mkdirs(); } @@ -79,13 +79,12 @@ class PDFontTest * Test of the error reported in PDFBOX-988 * * @throws IOException - * @throws URISyntaxException */ @Test - void testPDFBox988() throws IOException, URISyntaxException + void testPDFBox988() throws IOException { try (PDDocument doc = - Loader.loadPDF(new File(PDFontTest.class.getResource("F001u_3_7j.pdf").toURI()))) + Loader.loadPDF(new RandomAccessReadBuffer(PDFontTest.class.getResourceAsStream("F001u_3_7j.pdf")))) { PDFRenderer renderer = new PDFRenderer(doc); renderer.renderImage(0); Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/TestFontEncoding.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/TestFontEncoding.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/TestFontEncoding.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/TestFontEncoding.java Sat Apr 12 12:58:34 2025 @@ -48,7 +48,7 @@ class TestFontEncoding * Test the add method of a font encoding. */ @Test - void testAdd() throws Exception + void testAdd() { // see PDFDBOX-3332 int codeForSpace = WinAnsiEncoding.INSTANCE.getNameToCodeMap().get("space"); @@ -59,7 +59,7 @@ class TestFontEncoding } @Test - void testOverwrite() throws Exception + void testOverwrite() { // see PDFDBOX-3332 COSDictionary dictEncodingDict = new COSDictionary(); @@ -83,27 +83,31 @@ class TestFontEncoding @Test void testPDFBox3884() throws IOException { - PDDocument doc = new PDDocument(); - PDPage page = new PDPage(); - doc.addPage(page); - PDPageContentStream cs = new PDPageContentStream(doc, page); - cs.setFont(new PDType1Font(FontName.HELVETICA), 20); - cs.beginText(); - cs.newLineAtOffset(100, 700); - // first tilde is "asciitilde" (from the keyboard), 2nd tilde is "tilde" - // using Ë would bring IllegalArgumentException prior to bugfix - cs.showText("~Ë"); - cs.endText(); - cs.close(); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - doc.save(baos); - doc.close(); + ByteArrayOutputStream baos; + try (PDDocument doc = new PDDocument()) + { + PDPage page = new PDPage(); + doc.addPage(page); + try (PDPageContentStream cs = new PDPageContentStream(doc, page)) + { + cs.setFont(new PDType1Font(FontName.HELVETICA), 20); + cs.beginText(); + cs.newLineAtOffset(100, 700); + // first tilde is "asciitilde" (from the keyboard), 2nd tilde is "tilde" + // using Ë would bring IllegalArgumentException prior to bugfix + cs.showText("~Ë"); + cs.endText(); + } + baos = new ByteArrayOutputStream(); + doc.save(baos); + } // verify - doc = Loader.loadPDF(baos.toByteArray()); - PDFTextStripper stripper = new PDFTextStripper(); - String text = stripper.getText(doc); - assertEquals("~Ë", text.trim()); - doc.close(); + try (PDDocument doc = Loader.loadPDF(baos.toByteArray())) + { + PDFTextStripper stripper = new PDFTextStripper(); + String text = stripper.getText(doc); + assertEquals("~Ë", text.trim()); + } } } Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/optionalcontent/TestOptionalContentGroups.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/optionalcontent/TestOptionalContentGroups.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/optionalcontent/TestOptionalContentGroups.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/optionalcontent/TestOptionalContentGroups.java Sat Apr 12 12:58:34 2025 @@ -73,10 +73,10 @@ class TestOptionalContentGroups /** * Tests OCG generation. - * @throws Exception if an error occurs + * @throws IOException if an error occurs */ @Test - void testOCGGeneration() throws Exception + void testOCGGeneration() throws IOException { try (PDDocument doc = new PDDocument()) { @@ -162,10 +162,10 @@ class TestOptionalContentGroups /** * Tests OCG functions on a loaded PDF. - * @throws Exception if an error occurs + * @throws IOException if an error occurs */ @Test - void testOCGConsumption() throws Exception + void testOCGConsumption() throws IOException { File pdfFile = new File(testResultsDir, "ocg-generation.pdf"); if (!pdfFile.exists()) @@ -256,7 +256,7 @@ class TestOptionalContentGroups } @Test - void testOCGsWithSameNameCanHaveDifferentVisibility() throws Exception + void testOCGsWithSameNameCanHaveDifferentVisibility() throws IOException { try (PDDocument doc = new PDDocument()) { Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/text/BidiTest.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/text/BidiTest.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/text/BidiTest.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/text/BidiTest.java Sat Apr 12 12:58:34 2025 @@ -94,7 +94,7 @@ class BidiTest * @param outDir The directory to store the output in * @param bLogResult Whether to log the extracted text * @param bSort Whether or not the extracted text is sorted - * @throws Exception when there is an exception + * @throws IOException when there is an exception */ private void doTestFile(File inFile, File outDir, boolean bLogResult, boolean bSort) throws IOException Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/text/TestTextStripper.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/text/TestTextStripper.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/text/TestTextStripper.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/text/TestTextStripper.java Sat Apr 12 12:58:34 2025 @@ -234,10 +234,10 @@ class TestTextStripper * @param outDir The directory to store the output in * @param bLogResult Whether to log the extracted text * @param bSort Whether or not the extracted text is sorted - * @throws Exception when there is an exception + * @throws IOException when there is an exception */ private void doTestFile(File inFile, File outDir, boolean bLogResult, boolean bSort) - throws Exception + throws IOException { if(bSort) { @@ -541,7 +541,7 @@ class TestTextStripper * @param inDir Input directory search for PDF files in. * @param outDir Output directory where the temp files will be created. */ - private void doTestDir(File inDir, File outDir) throws Exception + private void doTestDir(File inDir, File outDir) throws IOException { File[] testFiles = inDir.listFiles((File dir, String name) -> name.endsWith(".pdf")); for (File testFile : testFiles) @@ -556,10 +556,10 @@ class TestTextStripper /** * Test to validate text extraction of file set. * - * @throws Exception when there is an exception + * @throws IOException when there is an exception */ @Test - void testExtract() throws Exception + void testExtract() throws IOException { String filename = System.getProperty("org.apache.pdfbox.util.TextStripper.file"); File inDir = new File("src/test/resources/input"); @@ -696,10 +696,10 @@ class TestTextStripper /** * PDFBOX-3774: test the IgnoreContentStreamSpaceGlyphs option. * - * @throws Exception + * @throws IOException */ @Test - void testIgnoreContentStreamSpaceGlyphs() throws Exception + void testIgnoreContentStreamSpaceGlyphs() throws IOException { try (PDDocument doc = new PDDocument()) { Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/MatrixTest.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/MatrixTest.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/MatrixTest.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/MatrixTest.java Sat Apr 12 12:58:34 2025 @@ -32,7 +32,7 @@ class MatrixTest { @Test - void testConstructionAndCopy() throws Exception + void testConstructionAndCopy() { Matrix m1 = new Matrix(); assertMatrixIsPristine(m1); @@ -141,7 +141,7 @@ class MatrixTest } @Test - void testOldMultiplication() throws Exception + void testOldMultiplication() { // This matrix will not change - we use it to drive the various multiplications. final Matrix testMatrix = new Matrix(); Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestDateUtil.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestDateUtil.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestDateUtil.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestDateUtil.java Sat Apr 12 12:58:34 2025 @@ -19,7 +19,6 @@ package org.apache.pdfbox.util; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; -import java.io.IOException; import java.text.ParsePosition; import java.util.Calendar; import java.util.GregorianCalendar; @@ -45,11 +44,9 @@ class TestDateUtil /** * Test common date formats. - * - * @throws Exception when there is an exception */ @Test - void testExtract() throws Exception + void testExtract() { TimeZone timezone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("UTC")); @@ -80,11 +77,9 @@ class TestDateUtil /** * Test case for * <a href="https://issues.apache.org/jira/browse/PDFBOX-598">PDFBOX-598</a>. - * - * @throws IOException if something went wrong. */ @Test - void testDateConversion() throws IOException + void testDateConversion() { Calendar c = DateConverter.toCalendar("D:20050526205258+01'00'"); assertEquals(2005, c.get(Calendar.YEAR)); @@ -108,11 +103,10 @@ class TestDateUtil * @param offsetHours expected timezone offset in hours (-11..11) * @param offsetMinutes expected timezone offset in minutes (0..59) * @param orig A date to be parsed. - * @throws Exception If an unexpected error occurs. */ private static void checkParse(int yr, int mon, int day, int hr, int min, int sec, int offsetHours, int offsetMinutes, - String orig) throws Exception + String orig) { String pdfDate = String.format(Locale.US, "D:%04d%02d%02d%02d%02d%02d%+03d'%02d'", yr,mon,day,hr,min,sec,offsetHours,offsetMinutes); @@ -140,10 +134,9 @@ class TestDateUtil /** * Test dates in various formats. * Years differ to make it easier to find failures. - * @throws Exception none expected */ @Test - void testDateConverter() throws Exception + void testDateConverter() { int year = Calendar.getInstance().get(Calendar.YEAR); checkParse(2010, 4,23, 0, 0, 0, 0, 0, "D:20100423"); @@ -292,7 +285,7 @@ class TestDateUtil private static void checkToString(int yr, int mon, int day, int hr, int min, int sec, - TimeZone tz, int offsetHours, int offsetMinutes) throws Exception + TimeZone tz, int offsetHours, int offsetMinutes) { // construct a GregoreanCalendar from args GregorianCalendar cal = new GregorianCalendar(tz, Locale.ENGLISH); @@ -310,11 +303,9 @@ class TestDateUtil /** * Test toString() and toISO8601() for various dates. - * - * @throws Exception if something went wrong. */ @Test - void testToString() throws Exception + void testToString() { // std DST TimeZone tzPgh = TimeZone.getTimeZone("America/New_York"); // -5 -4 TimeZone tzBerlin = TimeZone.getTimeZone("Europe/Berlin"); // +1 +2 Modified: pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/TestExtractText.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/TestExtractText.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/TestExtractText.java (original) +++ pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/TestExtractText.java Sat Apr 12 12:58:34 2025 @@ -22,8 +22,9 @@ import static org.junit.jupiter.api.Asse import static org.junit.jupiter.api.Assertions.assertNotNull; import java.io.ByteArrayOutputStream; +import java.io.IOException; import java.io.PrintStream; -import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; import java.nio.file.Path; import java.nio.file.Files; import java.nio.file.Paths; @@ -65,16 +66,8 @@ class TestExtractText void setUpStreams() { out.reset(); - try - { - printStream = new PrintStream(out, true, "utf-8"); - System.setOut(printStream); - } - catch (UnsupportedEncodingException e) - { - // shouldn't happen at all - e.printStackTrace(); - } + printStream = new PrintStream(out, true, StandardCharsets.UTF_8); + System.setOut(printStream); } @AfterEach @@ -89,18 +82,16 @@ class TestExtractText /** * Run the text extraction test using a pdf with embedded pdfs. - * - * @throws Exception if something went wrong */ @Test - void testEmbeddedPDFs() throws Exception + void testEmbeddedPDFs() { ExtractText app = new ExtractText(); CommandLine cmd = new CommandLine(app); int exitCode = cmd.execute("-i", TESTFILE1, "-console"); assertEquals(0, exitCode); - String result = out.toString("UTF-8"); + String result = out.toString(StandardCharsets.UTF_8); assertTrue(result.contains("PDF1")); assertTrue(result.contains("PDF2")); assertFalse(result.contains("PDF file: " + filename1)); @@ -111,18 +102,16 @@ class TestExtractText /** * Run the text extraction with -addFileName - * - * @throws Exception if something went wrong - */ + */ @Test - void testAddFileName() throws Exception + void testAddFileName() { ExtractText app = new ExtractText(); CommandLine cmd = new CommandLine(app); int exitCode = cmd.execute("-i", TESTFILE1, "-console", "-addFileName"); assertEquals(0, exitCode); - String result = out.toString("UTF-8"); + String result = out.toString(StandardCharsets.UTF_8); assertTrue(result.contains("PDF1")); assertTrue(result.contains("PDF2")); assertTrue(result.contains("PDF file: " + filename1)); @@ -133,16 +122,14 @@ class TestExtractText /** * Run the text extraction as a PDFBox repeatable subcommand - * - * @throws Exception if something went wrong */ @Test - void testPDFBoxRepeatableSubcommand() throws Exception + void testPDFBoxRepeatableSubcommand() { PDFBox.main(new String[] { "export:text", "-i", TESTFILE1, "-console", // "export:text", "-i", TESTFILE2, "-console" }); - String result = out.toString("UTF-8"); + String result = out.toString(StandardCharsets.UTF_8); assertTrue(result.contains("PDF1")); assertTrue(result.contains("PDF2")); assertFalse(result.contains("PDF file: " + filename1)); @@ -153,16 +140,14 @@ class TestExtractText /** * Run the text extraction as a PDFBox repeatable subcommand with -addFileName - * - * @throws Exception if something went wrong */ @Test - void testPDFBoxRepeatableSubcommandAddFileName() throws Exception + void testPDFBoxRepeatableSubcommandAddFileName() { PDFBox.main(new String[] { "export:text", "-i", TESTFILE1, "-console", "-addFileName", "export:text", "-i", TESTFILE2, "-console", "-addFileName" }); - String result = out.toString("UTF-8"); + String result = out.toString(StandardCharsets.UTF_8); assertTrue(result.contains("PDF1")); assertTrue(result.contains("PDF2")); assertTrue(result.contains("PDF file: " + filename1)); @@ -175,10 +160,10 @@ class TestExtractText * Run the text extraction as a PDFBox repeatable subcommand with -addFileName, with -o <outfile> and without * -append * - * @throws Exception if something went wrong + * @throws IOException */ @Test - void testPDFBoxRepeatableSubcommandAddFileNameOutfile(@TempDir Path tempDir) throws Exception + void testPDFBoxRepeatableSubcommandAddFileNameOutfile(@TempDir Path tempDir) throws IOException { Path path = null; try @@ -193,12 +178,12 @@ class TestExtractText } assertNotNull(path); - PDFBox.main(new String[] { "export:text", "-i", TESTFILE1, "-encoding", "UTF-8", + PDFBox.main(new String[] { "export:text", "-i", TESTFILE1, "-encoding", StandardCharsets.UTF_8.name(), "-addFileName", "-o", path.toString(), // - "export:text", "-i", TESTFILE2, "-encoding", "UTF-8", // + "export:text", "-i", TESTFILE2, "-encoding", StandardCharsets.UTF_8.name(), // "-addFileName", "-o", path.toString() }); - String result = new String(Files.readAllBytes(path), "UTF-8"); + String result = new String(Files.readAllBytes(path), StandardCharsets.UTF_8); assertFalse(result.contains("PDF1")); assertFalse(result.contains("PDF2")); assertFalse(result.contains("PDF file: " + filename1)); @@ -210,11 +195,11 @@ class TestExtractText /** * Run the text extraction as a PDFBox repeatable subcommand with -addFileName, -o <outfile> and -append * - * @throws Exception if something went wrong + * @throws IOException */ @Test void testPDFBoxRepeatableSubcommandAddFileNameOutfileAppend(@TempDir Path tempDir) - throws Exception + throws IOException { Path path = null; @@ -248,10 +233,10 @@ class TestExtractText * Simple test to check that the rotationMagic feature works. * * @param tempDir - * @throws Exception + * @throws IOException */ @Test - void testRotationMagic(@TempDir Path tempDir) throws Exception + void testRotationMagic(@TempDir Path tempDir) throws IOException { Path path = null; Modified: pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/imageio/TestImageIOUtils.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/imageio/TestImageIOUtils.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/imageio/TestImageIOUtils.java (original) +++ pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/imageio/TestImageIOUtils.java Sat Apr 12 12:58:34 2025 @@ -292,10 +292,10 @@ class TestImageIOUtils /** * Test to validate image rendering of file set. * - * @throws Exception when there is an exception + * @throws IOException when there is an exception */ @Test - void testRenderImage() throws Exception + void testRenderImage() throws IOException { String inDir = "src/test/resources/input/ImageIOUtil"; String outDir = "target/test-output/ImageIOUtil/"; Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/DateConverterTest.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/DateConverterTest.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/DateConverterTest.java (original) +++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/DateConverterTest.java Sat Apr 12 12:58:34 2025 @@ -46,10 +46,10 @@ class DateConverterTest * Test with additional time zone * information normally not supported by ISO8601 * - * @throws Exception when there is an exception + * @throws IOException when there is an exception */ @Test - void testDateConversion() throws Exception + void testDateConversion() throws IOException { // Test partial dates Calendar convDate = DateConverter.toCalendar("2015-02-02"); Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/DoubleSameTypeSchemaTest.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/DoubleSameTypeSchemaTest.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/DoubleSameTypeSchemaTest.java (original) +++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/DoubleSameTypeSchemaTest.java Sat Apr 12 12:58:34 2025 @@ -39,12 +39,10 @@ import org.junit.jupiter.api.Test; */ class DoubleSameTypeSchemaTest { - - private final XMPMetadata metadata = XMPMetadata.createXMPMetadata(); - @Test - void testDoubleDublinCore() throws Exception + void testDoubleDublinCore() { + XMPMetadata metadata = XMPMetadata.createXMPMetadata(); DublinCoreSchema dc1 = metadata.createAndAddDublinCoreSchema(); String ownPrefix = "test"; DublinCoreSchema dc2 = new DublinCoreSchema(metadata, ownPrefix); Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/TestValidatePermitedMetadata.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/TestValidatePermitedMetadata.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/TestValidatePermitedMetadata.java (original) +++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/TestValidatePermitedMetadata.java Sat Apr 12 12:58:34 2025 @@ -33,6 +33,7 @@ import static org.junit.jupiter.api.Asse import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.BufferedReader; +import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.lang.reflect.Field; @@ -44,7 +45,7 @@ import java.util.List; class TestValidatePermitedMetadata { - static Collection<Object[]> initializeParameters() throws Exception + static Collection<Object[]> initializeParameters() throws IOException { List<Object[]> params = new ArrayList<>(); InputStream is = TestValidatePermitedMetadata.class.getResourceAsStream("/permited_metadata.txt"); Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/TestXMPWithDefinedSchemas.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/TestXMPWithDefinedSchemas.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/TestXMPWithDefinedSchemas.java (original) +++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/TestXMPWithDefinedSchemas.java Sat Apr 12 12:58:34 2025 @@ -21,18 +21,19 @@ package org.apache.xmpbox; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; import java.io.InputStream; import java.util.stream.Stream; import org.apache.xmpbox.xml.DomXmpParser; +import org.apache.xmpbox.xml.XmpParsingException; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; class TestXMPWithDefinedSchemas { - static Stream<String> initializeParameters() throws Exception + static Stream<String> initializeParameters() { return Stream.of( "/validxmp/override_ns.rdf", @@ -45,13 +46,13 @@ class TestXMPWithDefinedSchemas @ParameterizedTest @MethodSource("initializeParameters") - void main(String path) throws Exception + void main(String path) throws XmpParsingException { InputStream is = this.getClass().getResourceAsStream(path); DomXmpParser builder = new DomXmpParser(); XMPMetadata rxmp = builder.parse(is); // ensure basic parsing was OK - assertTrue(rxmp.getAllSchemas().size()>0); + assertFalse(rxmp.getAllSchemas().isEmpty()); } } Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/TestXMPWithUndefinedSchemas.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/TestXMPWithUndefinedSchemas.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/TestXMPWithUndefinedSchemas.java (original) +++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/TestXMPWithUndefinedSchemas.java Sat Apr 12 12:58:34 2025 @@ -22,7 +22,7 @@ package org.apache.xmpbox; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -37,7 +37,7 @@ import org.junit.jupiter.params.provider class TestXMPWithUndefinedSchemas { - static Stream<Arguments> initializeParameters() throws Exception + static Stream<Arguments> initializeParameters() { return Stream.of( Arguments.of("/undefinedxmp/prism.xmp", "http://prismstandard.org/namespaces/basic/2.0/", "aggregationType", "journal") @@ -54,7 +54,7 @@ class TestXMPWithUndefinedSchemas builder.setStrictParsing(false); XMPMetadata rxmp = builder.parse(is); // ensure basic parsing was OK - assertTrue(rxmp.getAllSchemas().size()>0, "There should be a least one schema"); + assertFalse(rxmp.getAllSchemas().isEmpty(), "There should be a least one schema"); assertNotNull(rxmp.getSchema(namespace), "The schema for {" + namespace + "} should be available"); assertNotNull(rxmp.getSchema(namespace).getProperty(propertyName), "The schema for {" + namespace + "} should have a property {" + propertyName + "} "); assertEquals(rxmp.getSchema(namespace).getProperty(propertyName).getPropertyName(), propertyName, "The schema for {" + namespace + "} should have a property {" + propertyName + "} "); Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/AdobePDFTest.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/AdobePDFTest.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/AdobePDFTest.java (original) +++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/AdobePDFTest.java Sat Apr 12 12:58:34 2025 @@ -54,7 +54,7 @@ class AdobePDFTest @ParameterizedTest @MethodSource("initializeParameters") - void testElementValue(String property, PropertyType type, String value) throws Exception + void testElementValue(String property, PropertyType type, String value) throws ReflectiveOperationException { XMPSchemaTester xmpSchemaTester = new XMPSchemaTester(metadata, schema, schemaClass, property, type, value); xmpSchemaTester.testGetSetValue(); @@ -62,7 +62,7 @@ class AdobePDFTest @ParameterizedTest @MethodSource("initializeParameters") - void testElementProperty(String property, PropertyType type, String value) throws Exception + void testElementProperty(String property, PropertyType type, String value) throws ReflectiveOperationException { XMPSchemaTester xmpSchemaTester = new XMPSchemaTester(metadata, schema, schemaClass, property, type, value); xmpSchemaTester.testGetSetProperty(); Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/BasicJobTicketSchemaTest.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/BasicJobTicketSchemaTest.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/BasicJobTicketSchemaTest.java (original) +++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/BasicJobTicketSchemaTest.java Sat Apr 12 12:58:34 2025 @@ -24,17 +24,20 @@ import static org.junit.jupiter.api.Asse import static org.junit.jupiter.api.Assertions.assertNotNull; import java.io.ByteArrayOutputStream; +import javax.xml.transform.TransformerException; import org.apache.xmpbox.XMPMetadata; +import org.apache.xmpbox.type.BadFieldValueException; import org.apache.xmpbox.type.JobType; import org.apache.xmpbox.xml.DomXmpParser; +import org.apache.xmpbox.xml.XmpParsingException; import org.apache.xmpbox.xml.XmpSerializer; import org.junit.jupiter.api.Test; class BasicJobTicketSchemaTest { @Test - void testAddTwoJobs() throws Exception + void testAddTwoJobs() throws XmpParsingException, TransformerException, BadFieldValueException { XMPMetadata metadata = XMPMetadata.createXMPMetadata(); XmpSerializer serializer = new XmpSerializer(); @@ -57,7 +60,7 @@ class BasicJobTicketSchemaTest } @Test - void testAddWithDefaultPrefix() throws Exception + void testAddWithDefaultPrefix() throws XmpParsingException, TransformerException, BadFieldValueException { XMPMetadata metadata = XMPMetadata.createXMPMetadata(); XmpSerializer serializer = new XmpSerializer(); @@ -85,7 +88,7 @@ class BasicJobTicketSchemaTest } @Test - void testAddWithDefinedPrefix() throws Exception + void testAddWithDefinedPrefix() throws TransformerException, XmpParsingException, BadFieldValueException { XMPMetadata metadata = XMPMetadata.createXMPMetadata(); XmpSerializer serializer = new XmpSerializer(); Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/DublinCoreTest.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/DublinCoreTest.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/DublinCoreTest.java (original) +++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/DublinCoreTest.java Sat Apr 12 12:58:34 2025 @@ -46,7 +46,7 @@ class DublinCoreTest @ParameterizedTest @MethodSource("initializeParameters") - void testInitializedToNull(String fieldName, Types type, Cardinality card) throws Exception + void testInitializedToNull(String fieldName, Types type, Cardinality card) throws ReflectiveOperationException { SchemaTester schemaTester = new SchemaTester(metadata, schemaClass, fieldName, type, card); schemaTester.testInitializedToNull(); Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PDFAIdentificationOthersTest.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PDFAIdentificationOthersTest.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PDFAIdentificationOthersTest.java (original) +++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PDFAIdentificationOthersTest.java Sat Apr 12 12:58:34 2025 @@ -31,7 +31,7 @@ import org.junit.jupiter.api.Test; class PDFAIdentificationOthersTest { @Test - void testPDFAIdentification() throws Exception + void testPDFAIdentification() throws BadFieldValueException { XMPMetadata metadata = XMPMetadata.createXMPMetadata(); PDFAIdentificationSchema pdfaid = metadata.createAndAddPDFAIdentificationSchema(); @@ -70,7 +70,7 @@ class PDFAIdentificationOthersTest } @Test - void testBadVersionIdValueType() throws Exception + void testBadVersionIdValueType() { XMPMetadata metadata = XMPMetadata.createXMPMetadata(); PDFAIdentificationSchema pdfaid = metadata.createAndAddPDFAIdentificationSchema(); Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PDFAIdentificationTest.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PDFAIdentificationTest.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PDFAIdentificationTest.java (original) +++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PDFAIdentificationTest.java Sat Apr 12 12:58:34 2025 @@ -47,7 +47,7 @@ class PDFAIdentificationTest @ParameterizedTest @MethodSource("initializeParameters") - void testElementValue(String property, PropertyType type, Object value) throws Exception + void testElementValue(String property, PropertyType type, Object value) throws ReflectiveOperationException { XMPSchemaTester xmpSchemaTester = new XMPSchemaTester(metadata, schema, schemaClass, property, type, value); xmpSchemaTester.testGetSetValue(); @@ -55,13 +55,13 @@ class PDFAIdentificationTest @ParameterizedTest @MethodSource("initializeParameters") - void testElementProperty(String property, PropertyType type, Object value) throws Exception + void testElementProperty(String property, PropertyType type, Object value) throws ReflectiveOperationException { XMPSchemaTester xmpSchemaTester = new XMPSchemaTester(metadata, schema, schemaClass, property, type, value); xmpSchemaTester.testGetSetProperty(); } - static Stream<Arguments> initializeParameters() throws Exception + static Stream<Arguments> initializeParameters() { return Stream.of( Arguments.of("part", XMPSchemaTester.createPropertyType(Types.Integer), 1), Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PhotoshopSchemaTest.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PhotoshopSchemaTest.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PhotoshopSchemaTest.java (original) +++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PhotoshopSchemaTest.java Sat Apr 12 12:58:34 2025 @@ -44,7 +44,7 @@ class PhotoshopSchemaTest @ParameterizedTest @MethodSource("initializeParameters") - void testInitializedToNull(String fieldName, Types type, Cardinality card) throws Exception + void testInitializedToNull(String fieldName, Types type, Cardinality card) throws ReflectiveOperationException { SchemaTester schemaTester = new SchemaTester(metadata, schemaClass, fieldName, type, card); schemaTester.testInitializedToNull(); Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/SchemaTester.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/SchemaTester.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/SchemaTester.java (original) +++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/SchemaTester.java Sat Apr 12 12:58:34 2025 @@ -71,7 +71,7 @@ class SchemaTester extends AbstractTypeT this.cardinality = card; } - public void testInitializedToNull() throws Exception + public void testInitializedToNull() throws ReflectiveOperationException { XMPSchema schema = getSchema(); // default method Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/TestExifXmp.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/TestExifXmp.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/TestExifXmp.java (original) +++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/TestExifXmp.java Sat Apr 12 12:58:34 2025 @@ -34,11 +34,13 @@ import org.apache.xmpbox.xml.XmpSerializ import org.junit.jupiter.api.Test; import java.io.InputStream; +import javax.xml.transform.TransformerException; +import org.apache.xmpbox.xml.XmpParsingException; class TestExifXmp { @Test - void testNonStrict() throws Exception + void testNonStrict() throws XmpParsingException { InputStream is = this.getClass().getResourceAsStream("/validxmp/exif.xmp"); @@ -52,7 +54,7 @@ class TestExifXmp } @Test - void testGenerate() throws Exception + void testGenerate() throws TransformerException { XMPMetadata metadata = XMPMetadata.createXMPMetadata(); TypeMapping tmapping = metadata.getTypeMapping(); Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPBasicTest.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPBasicTest.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPBasicTest.java (original) +++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPBasicTest.java Sat Apr 12 12:58:34 2025 @@ -49,7 +49,7 @@ class XMPBasicTest @ParameterizedTest @MethodSource("initializeParameters") - void testElementValue(String property, PropertyType type, Object value) throws Exception + void testElementValue(String property, PropertyType type, Object value) throws ReflectiveOperationException { XMPSchemaTester xmpSchemaTester = new XMPSchemaTester(metadata, schema, schemaClass, property, type, value); xmpSchemaTester.testGetSetValue(); @@ -57,13 +57,13 @@ class XMPBasicTest @ParameterizedTest @MethodSource("initializeParameters") - void testElementProperty(String property, PropertyType type, Object value) throws Exception + void testElementProperty(String property, PropertyType type, Object value) throws ReflectiveOperationException { XMPSchemaTester xmpSchemaTester = new XMPSchemaTester(metadata, schema, schemaClass, property, type, value); xmpSchemaTester.testGetSetProperty(); } - static Stream<Arguments> initializeParameters() throws Exception + static Stream<Arguments> initializeParameters() { return Stream.of( Arguments.of("Advisory", XMPSchemaTester.createPropertyType(Types.XPath, Cardinality.Bag), new String[] { "xpath1", "xpath2" }), Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPMediaManagementTest.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPMediaManagementTest.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPMediaManagementTest.java (original) +++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPMediaManagementTest.java Sat Apr 12 12:58:34 2025 @@ -48,7 +48,7 @@ class XMPMediaManagementTest @ParameterizedTest @MethodSource("initializeParameters") - void testElementValue(String property, PropertyType type, Object value) throws Exception + void testElementValue(String property, PropertyType type, Object value) throws ReflectiveOperationException { XMPSchemaTester xmpSchemaTester = new XMPSchemaTester(metadata, schema, schemaClass, property, type, value); xmpSchemaTester.testGetSetValue(); @@ -56,13 +56,13 @@ class XMPMediaManagementTest @ParameterizedTest @MethodSource("initializeParameters") - void testElementProperty(String property, PropertyType type, Object value) throws Exception + void testElementProperty(String property, PropertyType type, Object value) throws ReflectiveOperationException, ReflectiveOperationException { XMPSchemaTester xmpSchemaTester = new XMPSchemaTester(metadata, schema, schemaClass, property, type, value); xmpSchemaTester.testGetSetProperty(); } - static Stream<Arguments> initializeParameters() throws Exception + static Stream<Arguments> initializeParameters() { return Stream.of( Arguments.of("DocumentID", XMPSchemaTester.createPropertyType(Types.URI), "uuid:FB031973-5E75-11B2-8F06-E7F5C101C07A"), Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XmpRightsSchemaTest.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XmpRightsSchemaTest.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XmpRightsSchemaTest.java (original) +++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XmpRightsSchemaTest.java Sat Apr 12 12:58:34 2025 @@ -50,7 +50,7 @@ class XmpRightsSchemaTest @ParameterizedTest @MethodSource("initializeParameters") - void testElementValue(String property, PropertyType type, Object value) throws Exception + void testElementValue(String property, PropertyType type, Object value) throws ReflectiveOperationException { XMPSchemaTester xmpSchemaTester = new XMPSchemaTester(metadata, schema, schemaClass, property, type, value); xmpSchemaTester.testGetSetValue(); @@ -58,13 +58,13 @@ class XmpRightsSchemaTest @ParameterizedTest @MethodSource("initializeParameters") - void testElementProperty(String property, PropertyType type, Object value) throws Exception + void testElementProperty(String property, PropertyType type, Object value) throws ReflectiveOperationException { XMPSchemaTester xmpSchemaTester = new XMPSchemaTester(metadata, schema, schemaClass, property, type, value); xmpSchemaTester.testGetSetProperty(); } - static Stream<Arguments> initializeParameters() throws Exception + static Stream<Arguments> initializeParameters() { Map<String, String> desc = new HashMap<>(2); desc.put("fr", "Termes d'utilisation"); Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestAbstractStructuredType.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestAbstractStructuredType.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestAbstractStructuredType.java (original) +++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestAbstractStructuredType.java Sat Apr 12 12:58:34 2025 @@ -56,7 +56,7 @@ class TestAbstractStructuredType protected final MyStructuredType st = new MyStructuredType(xmp, MY_NS, MY_PREFIX); @Test - void validate() throws Exception + void validate() { assertEquals(MY_NS, st.getNamespace()); assertEquals(MY_PREFIX, st.getPrefix()); @@ -64,19 +64,19 @@ class TestAbstractStructuredType } @Test - void testNonExistingProperty() throws Exception + void testNonExistingProperty() { assertNull(st.getProperty("NOT_EXISTING")); } @Test - void testNotValuatedPropertyProperty() throws Exception + void testNotValuatedPropertyProperty() { assertNull(st.getProperty(MyStructuredType.MYTEXT)); } @Test - void testValuatedTextProperty() throws Exception + void testValuatedTextProperty() { String s = "my value"; st.addSimpleProperty(MyStructuredType.MYTEXT, s); @@ -86,7 +86,7 @@ class TestAbstractStructuredType } @Test - void testValuatedDateProperty() throws Exception + void testValuatedDateProperty() { Calendar c = Calendar.getInstance(); st.addSimpleProperty(MyStructuredType.MYDATE, c); Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestDerivedType.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestDerivedType.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestDerivedType.java (original) +++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestDerivedType.java Sat Apr 12 12:58:34 2025 @@ -51,7 +51,7 @@ class TestDerivedType protected Constructor<? extends TextType> constructor = null; @BeforeEach - void before() throws Exception + void before() { xmp = XMPMetadata.createXMPMetadata(); } Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestSimpleMetadataProperties.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestSimpleMetadataProperties.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestSimpleMetadataProperties.java (original) +++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestSimpleMetadataProperties.java Sat Apr 12 12:58:34 2025 @@ -88,7 +88,7 @@ class TestSimpleMetadataProperties * @throws IllegalArgumentException */ @Test - void testRealBadTypeDetection() throws Exception + void testRealBadTypeDetection() { assertThrows(IllegalArgumentException.class, () -> { new RealType(parent, null, "test", "real", "Not a real"); @@ -101,7 +101,7 @@ class TestSimpleMetadataProperties * @throws IllegalArgumentException */ @Test - void testTextBadTypeDetection() throws Exception + void testTextBadTypeDetection() { Calendar calendar = Calendar.getInstance(); assertThrows(IllegalArgumentException.class, () -> { @@ -111,11 +111,9 @@ class TestSimpleMetadataProperties /** * Check if information between objects and the element generated are equals - * - * @throws Exception */ @Test - void testElementAndObjectSynchronization() throws Exception + void testElementAndObjectSynchronization() { boolean boolv = true; Calendar datev = Calendar.getInstance(); @@ -133,16 +131,13 @@ class TestSimpleMetadataProperties assertEquals(Integer.valueOf(integerv), integer.getValue()); assertEquals(realv, real.getValue(), 0); assertEquals(textv, text.getStringValue()); - } /** * Check the creation from string attributes - * - * @throws Exception */ @Test - void testCreationFromString() throws Exception + void testCreationFromString() { String boolv = "False"; String datev = "2010-03-22T14:33:11+01:00"; @@ -165,11 +160,9 @@ class TestSimpleMetadataProperties /** * Check creation when a namespace is specified - * - * @throws Exception */ @Test - void testObjectCreationWithNamespace() throws Exception + void testObjectCreationWithNamespace() { String ns = "http://www.test.org/pdfa/"; BooleanType bool = parent.getTypeMapping().createBoolean(ns, "test", "boolean", true); @@ -183,7 +176,6 @@ class TestSimpleMetadataProperties assertEquals(ns, integer.getNamespace()); assertEquals(ns, real.getNamespace()); assertEquals(ns, text.getNamespace()); - } /** @@ -192,7 +184,7 @@ class TestSimpleMetadataProperties * @throws IllegalArgumentException */ @Test - void testExceptionWithCause() throws Exception + void testExceptionWithCause() { Throwable throwable = new Throwable(); assertThrows(IllegalArgumentException.class, () -> { @@ -202,11 +194,9 @@ class TestSimpleMetadataProperties /** * Check if attributes management works - * - * @throws Exception */ @Test - void testAttribute() throws Exception + void testAttribute() { IntegerType integer = new IntegerType(parent, null, "test", "integer", 1); Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestStructuredType.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestStructuredType.java?rev=1925045&r1=1925044&r2=1925045&view=diff ============================================================================== --- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestStructuredType.java (original) +++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestStructuredType.java Sat Apr 12 12:58:34 2025 @@ -42,7 +42,7 @@ class TestStructuredType extends Abstrac @ParameterizedTest @MethodSource("initializeParameters") - void testInitializedToNull(AbstractStructuredType structured, Class<? extends AbstractStructuredType> clz, String fieldName, Types type) throws Exception + void testInitializedToNull(AbstractStructuredType structured, Class<? extends AbstractStructuredType> clz, String fieldName, Types type) throws ReflectiveOperationException { assertNull(structured.getProperty(fieldName)); // accessor @@ -53,14 +53,14 @@ class TestStructuredType extends Abstrac @ParameterizedTest @MethodSource("initializeParameters") - void testSettingValue(AbstractStructuredType structured, Class<? extends AbstractStructuredType> clz, String fieldName, Types type) throws Exception + void testSettingValue(AbstractStructuredType structured, Class<? extends AbstractStructuredType> clz, String fieldName, Types type) throws ReflectiveOperationException { internalTestSettingValue(structured, clz, fieldName, type); } @ParameterizedTest @MethodSource("initializeParameters") - void testRandomSettingValue(AbstractStructuredType structured, Class<? extends AbstractStructuredType> clz, String fieldName, Types type) throws Exception + void testRandomSettingValue(AbstractStructuredType structured, Class<? extends AbstractStructuredType> clz, String fieldName, Types type) throws ReflectiveOperationException { initializeSeed(new Random()); for (int i=0; i < RAND_LOOP_COUNT;i++) @@ -68,7 +68,7 @@ class TestStructuredType extends Abstrac internalTestSettingValue(structured, clz, fieldName, type); } } - private void internalTestSettingValue(AbstractStructuredType structured, Class<? extends AbstractStructuredType> clz, String fieldName, Types type) throws Exception + private void internalTestSettingValue(AbstractStructuredType structured, Class<? extends AbstractStructuredType> clz, String fieldName, Types type) throws ReflectiveOperationException { Object value = getJavaValue(type); structured.addSimpleProperty(fieldName, value); @@ -88,14 +88,14 @@ class TestStructuredType extends Abstrac @ParameterizedTest @MethodSource("initializeParameters") - void testPropertyType(AbstractStructuredType structured, Class<? extends AbstractStructuredType> clz, String fieldName, Types type) throws Exception + void testPropertyType(AbstractStructuredType structured, Class<? extends AbstractStructuredType> clz, String fieldName, Types type) throws ReflectiveOperationException { internalTestPropertyType(structured, clz, fieldName, type); } @ParameterizedTest @MethodSource("initializeParameters") - void testRandomPropertyType(AbstractStructuredType structured, Class<? extends AbstractStructuredType> clz, String fieldName, Types type) throws Exception + void testRandomPropertyType(AbstractStructuredType structured, Class<? extends AbstractStructuredType> clz, String fieldName, Types type) throws ReflectiveOperationException { initializeSeed(new Random()); for (int i=0; i < RAND_LOOP_COUNT;i++) @@ -104,8 +104,7 @@ class TestStructuredType extends Abstrac } } - - private void internalTestPropertyType(AbstractStructuredType structured, Class<? extends AbstractStructuredType> clz, String fieldName, Types type) throws Exception + private void internalTestPropertyType(AbstractStructuredType structured, Class<? extends AbstractStructuredType> clz, String fieldName, Types type) throws ReflectiveOperationException { Object value = getJavaValue(type); structured.addSimpleProperty(fieldName, value); @@ -118,14 +117,14 @@ class TestStructuredType extends Abstrac @ParameterizedTest @MethodSource("initializeParameters") - void testSetter(AbstractStructuredType structured, Class<? extends AbstractStructuredType> clz, String fieldName, Types type) throws Exception + void testSetter(AbstractStructuredType structured, Class<? extends AbstractStructuredType> clz, String fieldName, Types type) throws ReflectiveOperationException { internalTestSetter(structured, clz, fieldName, type); } @ParameterizedTest @MethodSource("initializeParameters") - void testRandomSetter(AbstractStructuredType structured, Class<? extends AbstractStructuredType> clz, String fieldName, Types type) throws Exception + void testRandomSetter(AbstractStructuredType structured, Class<? extends AbstractStructuredType> clz, String fieldName, Types type) throws ReflectiveOperationException { initializeSeed(new Random()); for (int i=0; i < RAND_LOOP_COUNT;i++) @@ -134,7 +133,7 @@ class TestStructuredType extends Abstrac } } - private void internalTestSetter(AbstractStructuredType structured, Class<? extends AbstractStructuredType> clz, String fieldName, Types type) throws Exception + private void internalTestSetter(AbstractStructuredType structured, Class<? extends AbstractStructuredType> clz, String fieldName, Types type) throws ReflectiveOperationException { String setter = calculateSimpleSetter(fieldName); Object value = getJavaValue(type);