diff --git a/pom.xml b/pom.xml
index 3bd6bd4..074063c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,7 +32,7 @@ limitations under the License.
setUp.
*/ - @Before + @BeforeEach public void setUp() { initWriter(); } @@ -58,7 +58,7 @@ public void setUp() { /** *tearDown.
*/ - @After + @AfterEach public void tearDown() { writer = null; w = null; @@ -175,7 +175,7 @@ public void testendElementAlreadyClosed() { public void testIssue51DetectJava7ConcatenationBug() throws IOException { File dir = new File("target/test-xml"); if (!dir.exists()) { - assertTrue("cannot create directory test-xml", dir.mkdir()); + assertTrue(dir.mkdir(), "cannot create directory test-xml"); } File xmlFile = new File(dir, "test-issue-51.xml"); OutputStreamWriter osw = new OutputStreamWriter(Files.newOutputStream(xmlFile.toPath()), "UTF-8"); diff --git a/src/test/java/org/codehaus/plexus/util/xml/XmlStreamReaderTest.java b/src/test/java/org/codehaus/plexus/util/xml/XmlStreamReaderTest.java index 93f4eac..4ffe7a9 100644 --- a/src/test/java/org/codehaus/plexus/util/xml/XmlStreamReaderTest.java +++ b/src/test/java/org/codehaus/plexus/util/xml/XmlStreamReaderTest.java @@ -21,9 +21,12 @@ import java.io.InputStream; import java.io.SequenceInputStream; -import junit.framework.ComparisonFailure; -import junit.framework.TestCase; import org.codehaus.plexus.util.IOUtil; +import org.junit.jupiter.api.Test; +import org.opentest4j.AssertionFailedError; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; /** *XmlStreamReaderTest class.
@@ -32,7 +35,7 @@ * @version $Id: $Id * @since 3.4.0 */ -public class XmlStreamReaderTest extends TestCase { +public class XmlStreamReaderTest { /** french */ private static final String TEXT_LATIN1 = "eacute: \u00E9"; @@ -111,6 +114,7 @@ private static void checkXmlStreamReader(String text, String encoding, String ef * * @throws java.io.IOException if any. */ + @Test public void testNoXmlHeader() throws IOException { String xml = "XmlStreamWriterTest class.
diff --git a/src/test/java/org/codehaus/plexus/util/xml/XmlUtilTest.java b/src/test/java/org/codehaus/plexus/util/xml/XmlUtilTest.java index bdfd76c..302bc28 100644 --- a/src/test/java/org/codehaus/plexus/util/xml/XmlUtilTest.java +++ b/src/test/java/org/codehaus/plexus/util/xml/XmlUtilTest.java @@ -27,10 +27,9 @@ import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.StringUtils; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.*; /** * Test the {@link org.codehaus.plexus.util.xml.XmlUtil} class. diff --git a/src/test/java/org/codehaus/plexus/util/xml/XmlWriterUtilTest.java b/src/test/java/org/codehaus/plexus/util/xml/XmlWriterUtilTest.java index 8b0e397..fb51578 100644 --- a/src/test/java/org/codehaus/plexus/util/xml/XmlWriterUtilTest.java +++ b/src/test/java/org/codehaus/plexus/util/xml/XmlWriterUtilTest.java @@ -21,12 +21,11 @@ import java.io.Writer; import org.codehaus.plexus.util.StringUtils; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.*; /** *XmlWriterUtilTest class.
@@ -47,7 +46,7 @@ public class XmlWriterUtilTest { * * @throws java.lang.Exception if any. */ - @Before + @BeforeEach public void setUp() throws Exception { output = new ByteArrayOutputStream(); writer = WriterFactory.newXmlWriter(output); @@ -59,7 +58,7 @@ public void setUp() throws Exception { * * @throws java.lang.Exception if any. */ - @After + @AfterEach public void tearDown() throws Exception { xmlWriter = null; writer = null; diff --git a/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomBuilderTest.java b/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomBuilderTest.java index f9faac4..c8db71b 100644 --- a/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomBuilderTest.java +++ b/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomBuilderTest.java @@ -23,11 +23,9 @@ import org.codehaus.plexus.util.xml.pull.MXParser; import org.codehaus.plexus.util.xml.pull.XmlPullParser; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.*; /** * Test the Xpp3DomBuilder. @@ -52,7 +50,7 @@ public void testBuildFromReader() throws Exception { Xpp3Dom expectedDom = createExpectedDom(); - assertEquals("check DOMs match", expectedDom, dom); + assertEquals(expectedDom, dom, "check DOMs match"); } /** @@ -66,12 +64,11 @@ public void testBuildTrimming() throws Exception { Xpp3Dom dom = Xpp3DomBuilder.build(new StringReader(domString), true); - assertEquals("test with trimming on", "element1", dom.getChild("el1").getValue()); + assertEquals("element1", dom.getChild("el1").getValue(), "test with trimming on"); dom = Xpp3DomBuilder.build(new StringReader(domString), false); - assertEquals( - "test with trimming off", " element1\n ", dom.getChild("el1").getValue()); + assertEquals(" element1\n ", dom.getChild("el1").getValue(), "test with trimming off"); } /** @@ -116,10 +113,10 @@ public void testBuildFromXpp3Dom() throws Exception { eventType = parser.next(); } - assertEquals("Check DOM matches", expectedDom, dom); - assertFalse("Check closing root was consumed", rootClosed); - assertTrue("Check continued to parse configuration", configurationClosed); - assertTrue("Check continued to parse newRoot", newRootClosed); + assertEquals(expectedDom, dom, "Check DOM matches"); + assertFalse(rootClosed, "Check closing root was consumed"); + assertTrue(configurationClosed, "Check continued to parse configuration"); + assertTrue(newRootClosed, "Check continued to parse newRoot"); } /** @@ -149,15 +146,13 @@ public void testUnclosedXml() { public void testEscapingInContent() throws IOException, XmlPullParserException { Xpp3Dom dom = Xpp3DomBuilder.build(new StringReader(getEncodedString())); - assertEquals("Check content value", "\"text\"", dom.getChild("el").getValue()); - assertEquals( - "Check content value", "\"text\"", dom.getChild("ela").getValue()); - assertEquals( - "Check content value", "\"text\"", dom.getChild("elb").getValue()); + assertEquals("\"text\"", dom.getChild("el").getValue(), "Check content value"); + assertEquals("\"text\"", dom.getChild("ela").getValue(), "Check content value"); + assertEquals("\"text\"", dom.getChild("elb").getValue(), "Check content value"); StringWriter w = new StringWriter(); Xpp3DomWriter.write(w, dom); - assertEquals("Compare stringified DOMs", getExpectedString(), w.toString()); + assertEquals(getExpectedString(), w.toString(), "Compare stringified DOMs"); } /** @@ -171,12 +166,12 @@ public void testEscapingInAttributes() throws IOException, XmlPullParserExceptio String s = getAttributeEncodedString(); Xpp3Dom dom = Xpp3DomBuilder.build(new StringReader(s)); - assertEquals("Check attribute value", "Xpp3DomTest class.
diff --git a/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomUtilsTest.java b/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomUtilsTest.java index ea21509..6632367 100644 --- a/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomUtilsTest.java +++ b/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomUtilsTest.java @@ -21,9 +21,9 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParser; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; /** *Xpp3DomUtilsTest class.
diff --git a/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomWriterTest.java b/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomWriterTest.java index 55853d0..7f7f321 100644 --- a/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomWriterTest.java +++ b/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomWriterTest.java @@ -18,9 +18,9 @@ import java.io.StringWriter; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; /** *Xpp3DomWriterTest class.
@@ -41,7 +41,7 @@ public void testWriter() { Xpp3DomWriter.write(writer, createXpp3Dom()); - assertEquals("Check if output matches", createExpectedXML(true), writer.toString()); + assertEquals(createExpectedXML(true), writer.toString(), "Check if output matches"); } /** @@ -53,7 +53,7 @@ public void testWriterNoEscape() { Xpp3DomWriter.write(new PrettyPrintXMLWriter(writer), createXpp3Dom(), false); - assertEquals("Check if output matches", createExpectedXML(false), writer.toString()); + assertEquals(createExpectedXML(false), writer.toString(), "Check if output matches"); } private String createExpectedXML(boolean escape) { diff --git a/src/test/java/org/codehaus/plexus/util/xml/pull/IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production24_Test.java b/src/test/java/org/codehaus/plexus/util/xml/pull/IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production24_Test.java index becde36..bb1a7e8 100644 --- a/src/test/java/org/codehaus/plexus/util/xml/pull/IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production24_Test.java +++ b/src/test/java/org/codehaus/plexus/util/xml/pull/IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production24_Test.java @@ -5,11 +5,11 @@ import java.io.IOException; import java.io.Reader; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; /** * Test class that execute a particular set of tests associated to a TESCASES tag from the XML W3C Conformance Tests. @@ -30,7 +30,7 @@ class IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConfo /** *setUp.
*/ - @Before + @BeforeEach public void setUp() { parser = new MXParser(); } diff --git a/src/test/java/org/codehaus/plexus/util/xml/pull/IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production2_Test.java b/src/test/java/org/codehaus/plexus/util/xml/pull/IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production2_Test.java index 71a342a..49227a4 100644 --- a/src/test/java/org/codehaus/plexus/util/xml/pull/IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production2_Test.java +++ b/src/test/java/org/codehaus/plexus/util/xml/pull/IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production2_Test.java @@ -12,11 +12,11 @@ import java.nio.file.Files; import java.nio.file.Paths; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; /** * Test class that execute a particular set of tests associated to a TESCASES tag from the XML W3C Conformance Tests. @@ -37,7 +37,7 @@ class IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConfo /** *setUp.
*/ - @Before + @BeforeEach public void setUp() { parser = new MXParser(); } diff --git a/src/test/java/org/codehaus/plexus/util/xml/pull/IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production32_Test.java b/src/test/java/org/codehaus/plexus/util/xml/pull/IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production32_Test.java index 91effa9..f99e1ea 100644 --- a/src/test/java/org/codehaus/plexus/util/xml/pull/IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production32_Test.java +++ b/src/test/java/org/codehaus/plexus/util/xml/pull/IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production32_Test.java @@ -5,11 +5,11 @@ import java.io.IOException; import java.io.Reader; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; /** * Test class that execute a particular set of tests associated to a TESCASES tag from the XML W3C Conformance Tests. @@ -30,7 +30,7 @@ class IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConfo /** *setUp.
*/ - @Before + @BeforeEach public void setUp() { parser = new MXParser(); } diff --git a/src/test/java/org/codehaus/plexus/util/xml/pull/IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production66_Test.java b/src/test/java/org/codehaus/plexus/util/xml/pull/IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production66_Test.java index 3266b72..debe597 100644 --- a/src/test/java/org/codehaus/plexus/util/xml/pull/IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production66_Test.java +++ b/src/test/java/org/codehaus/plexus/util/xml/pull/IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production66_Test.java @@ -6,11 +6,11 @@ import java.io.IOException; import java.io.Reader; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; /** * Test class that execute a particular set of tests associated to a TESCASES tag from the XML W3C Conformance Tests. @@ -31,7 +31,7 @@ class IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConfo /** *setUp.
*/ - @Before + @BeforeEach public void setUp() { parser = new MXParser(); } diff --git a/src/test/java/org/codehaus/plexus/util/xml/pull/IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production80_Test.java b/src/test/java/org/codehaus/plexus/util/xml/pull/IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production80_Test.java index 9b109a6..9581bed 100644 --- a/src/test/java/org/codehaus/plexus/util/xml/pull/IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production80_Test.java +++ b/src/test/java/org/codehaus/plexus/util/xml/pull/IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production80_Test.java @@ -5,11 +5,11 @@ import java.io.IOException; import java.io.Reader; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; /** * Test class that execute a particular set of tests associated to a TESCASES tag from the XML W3C Conformance Tests. @@ -30,7 +30,7 @@ class IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConfo /** *setUp.
*/ - @Before + @BeforeEach public void setUp() { parser = new MXParser(); } diff --git a/src/test/java/org/codehaus/plexus/util/xml/pull/MXParserTest.java b/src/test/java/org/codehaus/plexus/util/xml/pull/MXParserTest.java index 1833f73..2d3ecef 100644 --- a/src/test/java/org/codehaus/plexus/util/xml/pull/MXParserTest.java +++ b/src/test/java/org/codehaus/plexus/util/xml/pull/MXParserTest.java @@ -27,12 +27,12 @@ import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.xml.ReaderFactory; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; /** *MXParserTest class.
@@ -890,8 +890,8 @@ public void testEncodingISO_8859_1_setInputStream() throws IOException { } private static void assertPosition(int row, int col, MXParser parser) { - assertEquals("Current line", row, parser.getLineNumber()); - assertEquals("Current column", col, parser.getColumnNumber()); + assertEquals(row, parser.getLineNumber(), "Current line"); + assertEquals(col, parser.getColumnNumber(), "Current column"); } /** diff --git a/src/test/java/org/codehaus/plexus/util/xml/pull/eduni_misc_Test_BjoernHoehrmannviaHST2013_09_18_Test.java b/src/test/java/org/codehaus/plexus/util/xml/pull/eduni_misc_Test_BjoernHoehrmannviaHST2013_09_18_Test.java index 2ae6de3..65286c5 100644 --- a/src/test/java/org/codehaus/plexus/util/xml/pull/eduni_misc_Test_BjoernHoehrmannviaHST2013_09_18_Test.java +++ b/src/test/java/org/codehaus/plexus/util/xml/pull/eduni_misc_Test_BjoernHoehrmannviaHST2013_09_18_Test.java @@ -8,11 +8,11 @@ import java.io.Reader; import java.nio.charset.StandardCharsets; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; /** * Test class that execute a particular set of tests associated to a TESCASES tag from the XML W3C Conformance Tests. @@ -32,7 +32,7 @@ public class eduni_misc_Test_BjoernHoehrmannviaHST2013_09_18_Test { /** *setUp.
*/ - @Before + @BeforeEach public void setUp() { parser = new MXParser(); }