Author: lehmi Date: Tue Nov 17 07:21:48 2020 New Revision: 1883511 URL: http://svn.apache.org/viewvc?rev=1883511&view=rev Log: PDFBOX-5017: switch test to junit5
Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PlainTextTest.java pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestCheckBox.java pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestFields.java pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestListBox.java pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestRadioButtons.java Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PlainTextTest.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PlainTextTest.java?rev=1883511&r1=1883510&r2=1883511&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PlainTextTest.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/PlainTextTest.java Tue Nov 17 07:21:48 2020 @@ -16,9 +16,9 @@ */ package org.apache.pdfbox.pdmodel.interactive.form; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Test if a sequence of linebreak/paragraph characters produces the same @@ -26,44 +26,46 @@ import org.junit.Test; * via JavaScript. * */ -public class PlainTextTest { +class PlainTextTest +{ + @Test - public void characterCR() + void characterCR() { PlainText text = new PlainText("CR\rCR"); assertEquals(2,text.getParagraphs().size()); } @Test - public void characterLF() + void characterLF() { PlainText text = new PlainText("LF\nLF"); assertEquals(2,text.getParagraphs().size()); } @Test - public void characterCRLF() + void characterCRLF() { PlainText text = new PlainText("CRLF\r\nCRLF"); assertEquals(2,text.getParagraphs().size()); } @Test - public void characterLFCR() + void characterLFCR() { PlainText text = new PlainText("LFCR\n\rLFCR"); assertEquals(3,text.getParagraphs().size()); } @Test - public void characterUnicodeLinebreak() + void characterUnicodeLinebreak() { PlainText text = new PlainText("linebreak\u2028linebreak"); assertEquals(2,text.getParagraphs().size()); } @Test - public void characterUnicodeParagraphbreak() + void characterUnicodeParagraphbreak() { PlainText text = new PlainText("paragraphbreak\u2029paragraphbreak"); assertEquals(2,text.getParagraphs().size()); Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestCheckBox.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestCheckBox.java?rev=1883511&r1=1883510&r2=1883511&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestCheckBox.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestCheckBox.java Tue Nov 17 07:21:48 2020 @@ -16,14 +16,15 @@ */ package org.apache.pdfbox.pdmodel.interactive.form; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + import java.io.IOException; import java.util.ArrayList; import java.util.List; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSName; @@ -35,50 +36,21 @@ import org.apache.pdfbox.pdmodel.graphic import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget; import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceCharacteristicsDictionary; import org.apache.pdfbox.pdmodel.interactive.annotation.PDBorderStyleDictionary; +import org.junit.jupiter.api.Test; /** * This will test the functionality of checkboxes in PDFBox. */ -public class TestCheckBox extends TestCase +class TestCheckBox { /** - * Constructor. - * - * @param name The name of the test to run. - */ - public TestCheckBox( String name ) - { - super( name ); - } - - /** - * This will get the suite of test that this class holds. - * - * @return All of the tests that this class holds. - */ - public static Test suite() - { - return new TestSuite( TestCheckBox.class ); - } - - /** - * infamous main method. - * - * @param args The command line arguments. - */ - public static void main( String[] args ) - { - String[] arg = {TestCheckBox.class.getName() }; - junit.textui.TestRunner.main( arg ); - } - - /** * This will test the checkbox PDModel. * * @throws IOException If there is an error creating the field. */ - public void testCheckboxPDModel() throws IOException + @Test + void testCheckboxPDModel() throws IOException { try (PDDocument doc = new PDDocument()) { @@ -121,7 +93,8 @@ public class TestCheckBox extends TestCa * * @throws IOException */ - public void testCheckBoxNoAppearance() throws IOException + @Test + void testCheckBoxNoAppearance() throws IOException { try (PDDocument doc = new PDDocument()) { Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestFields.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestFields.java?rev=1883511&r1=1883510&r2=1883511&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestFields.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestFields.java Tue Nov 17 07:21:48 2020 @@ -16,24 +16,28 @@ */ package org.apache.pdfbox.pdmodel.interactive.form; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + import java.io.File; import java.io.IOException; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; import org.apache.pdfbox.Loader; import org.apache.pdfbox.cos.COSName; import org.apache.pdfbox.cos.COSString; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget; +import org.junit.jupiter.api.Test; /** * This will test the form fields in PDFBox. * * @author Ben Litchfield */ -public class TestFields extends TestCase +class TestFields { //private static Logger log = Logger.getLogger(TestFDF.class); @@ -41,42 +45,12 @@ public class TestFields extends TestCase /** - * Constructor. - * - * @param name The name of the test to run. - */ - public TestFields( String name ) - { - super( name ); - } - - /** - * This will get the suite of test that this class holds. - * - * @return All of the tests that this class holds. - */ - public static Test suite() - { - return new TestSuite( TestFields.class ); - } - - /** - * infamous main method. - * - * @param args The command line arguments. - */ - public static void main( String[] args ) - { - String[] arg = {TestFields.class.getName() }; - junit.textui.TestRunner.main( arg ); - } - - /** * This will test setting field flags on the PDField. * * @throws IOException If there is an error creating the field. */ - public void testFlags() throws IOException + @Test + void testFlags() throws IOException { try (PDDocument doc = new PDDocument()) { @@ -123,7 +97,8 @@ public class TestFields extends TestCase * * @throws IOException If there is an error creating the field. */ - public void testAcroFormsBasicFields() throws IOException + @Test + void testAcroFormsBasicFields() throws IOException { try (PDDocument doc = Loader.loadPDF(new File(PATH_OF_PDF))) { @@ -137,7 +112,7 @@ public class TestFields extends TestCase assertNull(textField.getCOSObject().getItem(COSName.V)); textField.setValue("field value"); assertNotNull(textField.getCOSObject().getItem(COSName.V)); - assertEquals(textField.getValue(),"field value"); + assertEquals("field value", textField.getValue()); // assert when setting to null the key has also been removed assertNotNull(textField.getCOSObject().getItem(COSName.V)); @@ -147,31 +122,30 @@ public class TestFields extends TestCase // get the TextField with a DV entry textField = (PDTextField)form.getField("TextField-DefaultValue"); assertNotNull(textField); - assertEquals(textField.getDefaultValue(),"DefaultValue"); + assertEquals("DefaultValue", textField.getDefaultValue()); assertEquals(textField.getDefaultValue(), ((COSString)textField.getCOSObject().getDictionaryObject(COSName.DV)).getString()); - assertEquals(textField.getDefaultAppearance(),"/Helv 12 Tf 0 g"); + assertEquals("/Helv 12 Tf 0 g", textField.getDefaultAppearance()); // get a rich text field with a DV entry textField = (PDTextField)form.getField("RichTextField-DefaultValue"); assertNotNull(textField); - assertEquals(textField.getDefaultValue(),"DefaultValue"); + assertEquals("DefaultValue", textField.getDefaultValue()); assertEquals(textField.getDefaultValue(), ((COSString)textField.getCOSObject().getDictionaryObject(COSName.DV)).getString()); - assertEquals(textField.getValue(), "DefaultValue"); - assertEquals(textField.getDefaultAppearance(), "/Helv 12 Tf 0 g"); - assertEquals(textField.getDefaultStyleString(), - "font: Helvetica,sans-serif 12.0pt; text-align:left; color:#000000 "); + assertEquals("DefaultValue", textField.getValue()); + assertEquals("/Helv 12 Tf 0 g", textField.getDefaultAppearance()); + assertEquals("font: Helvetica,sans-serif 12.0pt; text-align:left; color:#000000 ", + textField.getDefaultStyleString()); // do not test for the full content as this is a rather long xml string - assertEquals(textField.getRichTextValue().length(),338); + assertEquals(338, textField.getRichTextValue().length()); // get a rich text field with a text stream for the value textField = (PDTextField)form.getField("LongRichTextField"); assertNotNull(textField); - assertEquals(textField.getCOSObject().getDictionaryObject( - COSName.V).getClass().getName(), - "org.apache.pdfbox.cos.COSStream"); - assertEquals(textField.getValue().length(),145396); + assertEquals("org.apache.pdfbox.cos.COSStream", + textField.getCOSObject().getDictionaryObject(COSName.V).getClass().getName()); + assertEquals(145396, textField.getValue().length()); } } @@ -182,7 +156,8 @@ public class TestFields extends TestCase * * @throws IOException If there is an error loading the form or the field. */ - public void testWidgetMissingRect() throws IOException + @Test + void testWidgetMissingRect() throws IOException { try (PDDocument doc = Loader.loadPDF(new File(PATH_OF_PDF))) { Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestListBox.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestListBox.java?rev=1883511&r1=1883510&r2=1883511&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestListBox.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestListBox.java Tue Nov 17 07:21:48 2020 @@ -16,15 +16,16 @@ */ package org.apache.pdfbox.pdmodel.interactive.form; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.fail; + import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSName; import org.apache.pdfbox.pdmodel.PDDocument; @@ -34,50 +35,21 @@ import org.apache.pdfbox.pdmodel.common. import org.apache.pdfbox.pdmodel.font.PDFont; import org.apache.pdfbox.pdmodel.font.PDType1Font; import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget; +import org.junit.jupiter.api.Test; /** * This will test the functionality of choice fields in PDFBox. */ -public class TestListBox extends TestCase +class TestListBox { /** - * Constructor. - * - * @param name The name of the test to run. - */ - public TestListBox( String name ) - { - super( name ); - } - - /** - * This will get the suite of test that this class holds. - * - * @return All of the tests that this class holds. - */ - public static Test suite() - { - return new TestSuite( TestListBox.class ); - } - - /** - * infamous main method. - * - * @param args The command line arguments. - */ - public static void main( String[] args ) - { - String[] arg = {TestListBox.class.getName() }; - junit.textui.TestRunner.main( arg ); - } - - /** * This will test the list box PDModel. * * @throws IOException If there is an error creating the field. */ - public void testListboxPDModel() throws IOException + @Test + void testListboxPDModel() throws IOException { /* @@ -169,7 +141,7 @@ public class TestListBox extends TestCas // assert that the field value can be set choice.setValue("export01"); - assertEquals(choice.getValue().get(0),"export01"); + assertEquals("export01", choice.getValue().get(0)); // ensure that the choice field doesn't allow multiple selections choice.setMultiSelect(false); @@ -210,7 +182,7 @@ public class TestListBox extends TestCas choice.setOptions(null); assertNull(choice.getCOSObject().getItem(COSName.OPT)); // if there is no Opt entry an empty List shall be returned - assertEquals(choice.getOptions(), Collections.<String>emptyList()); + assertEquals(Collections.emptyList(), choice.getOptions()); /* * Test for setting export and display values @@ -224,12 +196,12 @@ public class TestListBox extends TestCas /* * Testing the sort option */ - assertEquals(choice.getOptionsDisplayValues().get(0),"display02"); + assertEquals("display02", choice.getOptionsDisplayValues().get(0)); choice.setSort(true); choice.setOptions(exportValues, displayValues); - assertEquals(choice.getOptionsDisplayValues().get(0),"display01"); - assertEquals(choice.getOptionsDisplayValues().get(1),"display02"); - assertEquals(choice.getOptionsDisplayValues().get(2),"display03"); + assertEquals("display01", choice.getOptionsDisplayValues().get(0)); + assertEquals("display02", choice.getOptionsDisplayValues().get(1)); + assertEquals("display03", choice.getOptionsDisplayValues().get(2)); /* * Setting options with an empty list @@ -239,9 +211,9 @@ public class TestListBox extends TestCas assertNull(choice.getCOSObject().getItem(COSName.OPT)); // if there is no Opt entry an empty list shall be returned - assertEquals(choice.getOptions(), Collections.<String>emptyList()); - assertEquals(choice.getOptionsDisplayValues(), Collections.<String>emptyList()); - assertEquals(choice.getOptionsExportValues(), Collections.<String>emptyList()); + assertEquals(Collections.emptyList(), choice.getOptions()); + assertEquals(Collections.emptyList(), choice.getOptionsDisplayValues()); + assertEquals(Collections.emptyList(), choice.getOptionsExportValues()); // test that an IllegalArgumentException is thrown when export and display // value lists have different sizes Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestRadioButtons.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestRadioButtons.java?rev=1883511&r1=1883510&r2=1883511&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestRadioButtons.java (original) +++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/form/TestRadioButtons.java Tue Nov 17 07:21:48 2020 @@ -16,12 +16,12 @@ */ package org.apache.pdfbox.pdmodel.interactive.form; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThrows; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; import java.net.URL; @@ -38,12 +38,12 @@ import org.apache.pdfbox.pdmodel.interac import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceEntry; import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * This will test the functionality of Radio Buttons in PDFBox. */ -public class TestRadioButtons +class TestRadioButtons { /** * This will test the radio button PDModel. @@ -51,7 +51,7 @@ public class TestRadioButtons * @throws IOException If there is an error creating the field. */ @Test - public void testRadioButtonPDModel() throws IOException + void testRadioButtonPDModel() throws IOException { try (PDDocument doc = new PDDocument()) { @@ -135,7 +135,7 @@ public class TestRadioButtons * @throws IOException */ @Test - public void testPDFBox3656NotInUnison() throws IOException + void testPDFBox3656NotInUnison() throws IOException { String sourceUrl = "https://issues.apache.org/jira/secure/attachment/12848122/SF1199AEG%20%28Complete%29.pdf"; @@ -144,7 +144,8 @@ public class TestRadioButtons { PDAcroForm acroForm = testPdf.getDocumentCatalog().getAcroForm(); PDRadioButton field = (PDRadioButton) acroForm.getField("Checking/Savings"); - assertFalse("the radio buttons can be selected individually although having the same ON value", field.isRadiosInUnison()); + assertFalse(field.isRadiosInUnison(), + "the radio buttons can be selected individually although having the same ON value"); } } @@ -157,7 +158,7 @@ public class TestRadioButtons * @throws IOException */ @Test - public void testPDFBox3656ByValidExportValue() throws IOException + void testPDFBox3656ByValidExportValue() throws IOException { String sourceUrl = "https://issues.apache.org/jira/secure/attachment/12848122/SF1199AEG%20%28Complete%29.pdf"; @@ -166,11 +167,13 @@ public class TestRadioButtons PDAcroForm acroForm = testPdf.getDocumentCatalog().getAcroForm(); PDRadioButton field = (PDRadioButton) acroForm.getField("Checking/Savings"); // check defaults - assertFalse("the radio buttons can be selected individually although having the same ON value", field.isRadiosInUnison()); - assertEquals("initially no option shall be selected", "Off", field.getValue()); + assertFalse(field.isRadiosInUnison(), + "the radio buttons can be selected individually although having the same ON value"); + assertEquals("Off", field.getValue(), "initially no option shall be selected"); // set the field to a valid export value field.setValue("Checking"); - assertEquals("setting by the export value should also return that", "Checking", field.getValue()); + assertEquals("Checking", field.getValue(), + "setting by the export value should also return that"); } } @@ -180,7 +183,7 @@ public class TestRadioButtons * @throws IOException */ @Test - public void testPDFBox3656ByInvalidExportValue() throws IOException + void testPDFBox3656ByInvalidExportValue() throws IOException { String sourceUrl = "https://issues.apache.org/jira/secure/attachment/12848122/SF1199AEG%20%28Complete%29.pdf"; @@ -189,8 +192,9 @@ public class TestRadioButtons PDAcroForm acroForm = testPdf.getDocumentCatalog().getAcroForm(); PDRadioButton field = (PDRadioButton) acroForm.getField("Checking/Savings"); // check defaults - assertFalse("the radio buttons can be selected individually although having the same ON value", field.isRadiosInUnison()); - assertEquals("initially no option shall be selected", "Off", field.getValue()); + assertFalse(field.isRadiosInUnison(), + "the radio buttons can be selected individually although having the same ON value"); + assertEquals("Off", field.getValue(), "initially no option shall be selected"); // set the field to an invalid value shall throw Exception exception = assertThrows(IllegalArgumentException.class, () -> { @@ -203,8 +207,8 @@ public class TestRadioButtons assertTrue(actualMessage.contains(expectedMessage)); - assertEquals("no option shall be selected", "Off", field.getValue()); - assertTrue("no export values are selected", field.getSelectedExportValues().isEmpty()); + assertEquals("Off", field.getValue(), "no option shall be selected"); + assertTrue(field.getSelectedExportValues().isEmpty(), "no export values are selected"); } } @@ -217,7 +221,7 @@ public class TestRadioButtons * @throws IOException */ @Test - public void testPDFBox3656ByValidIndex() throws IOException + void testPDFBox3656ByValidIndex() throws IOException { String sourceUrl = "https://issues.apache.org/jira/secure/attachment/12848122/SF1199AEG%20%28Complete%29.pdf"; @@ -226,11 +230,13 @@ public class TestRadioButtons PDAcroForm acroForm = testPdf.getDocumentCatalog().getAcroForm(); PDRadioButton field = (PDRadioButton) acroForm.getField("Checking/Savings"); // check defaults - assertFalse("the radio buttons can be selected individually although having the same ON value", field.isRadiosInUnison()); - assertEquals("initially no option shall be selected", "Off", field.getValue()); + assertFalse(field.isRadiosInUnison(), + "the radio buttons can be selected individually although having the same ON value"); + assertEquals("Off", field.getValue(), "initially no option shall be selected"); // set the field to a valid index field.setValue(4); - assertEquals("setting by the index value should return the corresponding export", "Checking", field.getValue()); + assertEquals("Checking", field.getValue(), + "setting by the index value should return the corresponding export"); } } @@ -243,7 +249,7 @@ public class TestRadioButtons * @throws IOException */ @Test - public void testPDFBox3656ByInvalidIndex() throws IOException + void testPDFBox3656ByInvalidIndex() throws IOException { String sourceUrl = "https://issues.apache.org/jira/secure/attachment/12848122/SF1199AEG%20%28Complete%29.pdf"; @@ -253,8 +259,9 @@ public class TestRadioButtons PDAcroForm acroForm = testPdf.getDocumentCatalog().getAcroForm(); PDRadioButton field = (PDRadioButton) acroForm.getField("Checking/Savings"); // check defaults - assertFalse("the radio buttons can be selected individually although having the same ON value", field.isRadiosInUnison()); - assertEquals("initially no option shall be selected", "Off", field.getValue()); + assertFalse(field.isRadiosInUnison(), + "the radio buttons can be selected individually although having the same ON value"); + assertEquals("Off", field.getValue(), "initially no option shall be selected"); // set the field to an invalid index shall throw Exception exception = assertThrows(IllegalArgumentException.class, () -> { @@ -267,8 +274,8 @@ public class TestRadioButtons assertTrue(actualMessage.contains(expectedMessage)); - assertEquals("no option shall be selected", "Off", field.getValue()); - assertTrue("no export values are selected", field.getSelectedExportValues().isEmpty()); + assertEquals("Off", field.getValue(), "no option shall be selected"); + assertTrue(field.getSelectedExportValues().isEmpty(),"no export values are selected"); } } @@ -278,7 +285,7 @@ public class TestRadioButtons * @throws IOException */ @Test - public void testPDFBox4617IndexNoneSelected() throws IOException + void testPDFBox4617IndexNoneSelected() throws IOException { String sourceUrl = "https://issues.apache.org/jira/secure/attachment/12848122/SF1199AEG%20%28Complete%29.pdf"; @@ -286,7 +293,8 @@ public class TestRadioButtons { PDAcroForm acroForm = testPdf.getDocumentCatalog().getAcroForm(); PDRadioButton field = (PDRadioButton) acroForm.getField("Checking/Savings"); - assertEquals("if there is no value set the index shall be -1", -1, field.getSelectedIndex()); + assertEquals(-1, field.getSelectedIndex(), + "if there is no value set the index shall be -1"); } } @@ -296,7 +304,7 @@ public class TestRadioButtons * @throws IOException */ @Test - public void testPDFBox4617IndexForSetByOption() throws IOException + void testPDFBox4617IndexForSetByOption() throws IOException { String sourceUrl = "https://issues.apache.org/jira/secure/attachment/12848122/SF1199AEG%20%28Complete%29.pdf"; @@ -305,7 +313,8 @@ public class TestRadioButtons PDAcroForm acroForm = testPdf.getDocumentCatalog().getAcroForm(); PDRadioButton field = (PDRadioButton) acroForm.getField("Checking/Savings"); field.setValue( "Checking"); - assertEquals("the index shall be equal with the first entry of Checking which is 0", 0, field.getSelectedIndex()); + assertEquals(0, field.getSelectedIndex(), + "the index shall be equal with the first entry of Checking which is 0"); } } @@ -315,7 +324,7 @@ public class TestRadioButtons * @throws IOException */ @Test - public void testPDFBox4617IndexForSetByIndex() throws IOException + void testPDFBox4617IndexForSetByIndex() throws IOException { String sourceUrl = "https://issues.apache.org/jira/secure/attachment/12848122/SF1199AEG%20%28Complete%29.pdf"; @@ -324,8 +333,10 @@ public class TestRadioButtons PDAcroForm acroForm = testPdf.getDocumentCatalog().getAcroForm(); PDRadioButton field = (PDRadioButton) acroForm.getField("Checking/Savings"); field.setValue(4); - assertEquals("setting by the index value should return the corresponding export", "Checking", field.getValue()); - assertEquals("the index shall be equals with the set value of 4", 4, field.getSelectedIndex()); + assertEquals("Checking", field.getValue(), + "setting by the index value should return the corresponding export"); + assertEquals(4, field.getSelectedIndex(), + "the index shall be equals with the set value of 4"); } } -} \ No newline at end of file +}