From ac8a2e67d7c32cb2b4a4ae79591cab1e949b4f01 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Fri, 7 Apr 2023 09:57:03 +0200 Subject: [PATCH] Switch to junit 5 --- pom.xml | 6 +-- .../util/xml/PrettyPrintXMLWriterTest.java | 43 +++++++------------ .../plexus/util/xml/XmlStreamReaderTest.java | 36 ++++++++++------ .../plexus/util/xml/XmlStreamWriterTest.java | 6 +-- .../codehaus/plexus/util/xml/XmlUtilTest.java | 7 ++- .../plexus/util/xml/XmlWriterUtilTest.java | 15 +++---- .../plexus/util/xml/Xpp3DomBuilderTest.java | 40 ++++++++--------- .../codehaus/plexus/util/xml/Xpp3DomTest.java | 12 ++---- .../plexus/util/xml/Xpp3DomUtilsTest.java | 7 ++- .../plexus/util/xml/Xpp3DomWriterTest.java | 10 ++--- ...onformanceTestSuite_Production24_Test.java | 12 +++--- ...ConformanceTestSuite_Production2_Test.java | 12 +++--- ...onformanceTestSuite_Production32_Test.java | 12 +++--- ...onformanceTestSuite_Production66_Test.java | 12 +++--- ...onformanceTestSuite_Production80_Test.java | 12 +++--- .../plexus/util/xml/pull/MXParserTest.java | 14 +++--- ..._BjoernHoehrmannviaHST2013_09_18_Test.java | 15 ++++--- 17 files changed, 128 insertions(+), 143 deletions(-) diff --git a/pom.xml b/pom.xml index de4e34bf..b231c210 100644 --- a/pom.xml +++ b/pom.xml @@ -71,9 +71,9 @@ limitations under the License. test - junit - junit - 4.13.2 + org.junit.jupiter + junit-jupiter + 5.9.2 test diff --git a/src/test/java/org/codehaus/plexus/util/xml/PrettyPrintXMLWriterTest.java b/src/test/java/org/codehaus/plexus/util/xml/PrettyPrintXMLWriterTest.java index 76125f95..af0bf253 100644 --- a/src/test/java/org/codehaus/plexus/util/xml/PrettyPrintXMLWriterTest.java +++ b/src/test/java/org/codehaus/plexus/util/xml/PrettyPrintXMLWriterTest.java @@ -16,10 +16,6 @@ * limitations under the License. */ -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - import java.io.File; import java.io.IOException; import java.io.OutputStreamWriter; @@ -30,9 +26,14 @@ import javax.swing.text.html.HTML.Tag; 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.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; /** * Test of {@link org.codehaus.plexus.util.xml.PrettyPrintXMLWriter} @@ -51,7 +52,7 @@ public class PrettyPrintXMLWriterTest /** *

setUp.

*/ - @Before + @BeforeEach public void setUp() { initWriter(); @@ -60,7 +61,7 @@ public void setUp() /** *

tearDown.

*/ - @After + @AfterEach public void tearDown() { writer = null; @@ -161,18 +162,12 @@ public void testEscapeXmlAttribute() @Test public void testendElementAlreadyClosed() { - try - { + assertThrows(NoSuchElementException.class, () -> { writer.startElement( Tag.DIV.toString() ); writer.addAttribute( "class", "someattribute" ); writer.endElement(); // Tag.DIV closed writer.endElement(); // Tag.DIV already closed, and there is no other outer tag! - fail( "Should throw a NoSuchElementException" ); - } - catch ( NoSuchElementException e ) - { - assert ( true ); - } + }); } /** @@ -190,16 +185,15 @@ public void testIssue51DetectJava7ConcatenationBug() 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" ); - writer = new PrettyPrintXMLWriter( osw ); int iterations = 20000; - try + try ( OutputStreamWriter osw = new OutputStreamWriter( Files.newOutputStream( xmlFile.toPath() ), "UTF-8" ) ) { + writer = new PrettyPrintXMLWriter( osw ); for ( int i = 0; i < iterations; ++i ) { writer.startElement( Tag.DIV.toString() + i ); @@ -214,13 +208,6 @@ public void testIssue51DetectJava7ConcatenationBug() { fail( "Should not throw a NoSuchElementException" ); } - finally - { - if ( osw != null ) - { - osw.close(); - } - } } private void writeXhtmlHead( XMLWriter writer ) 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 7ca8cc48..3fe0b515 100644 --- a/src/test/java/org/codehaus/plexus/util/xml/XmlStreamReaderTest.java +++ b/src/test/java/org/codehaus/plexus/util/xml/XmlStreamReaderTest.java @@ -23,8 +23,12 @@ import org.codehaus.plexus.util.IOUtil; -import junit.framework.ComparisonFailure; -import junit.framework.TestCase; +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; +import static org.junit.jupiter.api.Assertions.fail; /** *

XmlStreamReaderTest class.

@@ -34,7 +38,6 @@ * @since 3.4.0 */ public class XmlStreamReaderTest - extends TestCase { /** french */ private static final String TEXT_LATIN1 = "eacute: \u00E9"; @@ -127,6 +130,7 @@ private static void checkXmlStreamReader( String text, String encoding, String e * * @throws java.io.IOException if any. */ + @Test public void testNoXmlHeader() throws IOException { @@ -140,6 +144,7 @@ public void testNoXmlHeader() * * @throws java.io.IOException if any. */ + @Test public void testDefaultEncoding() throws IOException { @@ -152,6 +157,7 @@ public void testDefaultEncoding() * * @throws java.io.IOException if any. */ + @Test public void testUTF8Encoding() throws IOException { @@ -164,6 +170,7 @@ public void testUTF8Encoding() * * @throws java.io.IOException if any. */ + @Test public void testUTF16Encoding() throws IOException { @@ -177,6 +184,7 @@ public void testUTF16Encoding() * * @throws java.io.IOException if any. */ + @Test public void testUTF16BEEncoding() throws IOException { @@ -188,6 +196,7 @@ public void testUTF16BEEncoding() * * @throws java.io.IOException if any. */ + @Test public void testUTF16LEEncoding() throws IOException { @@ -199,6 +208,7 @@ public void testUTF16LEEncoding() * * @throws java.io.IOException if any. */ + @Test public void testLatin1Encoding() throws IOException { @@ -210,6 +220,7 @@ public void testLatin1Encoding() * * @throws java.io.IOException if any. */ + @Test public void testLatin7Encoding() throws IOException { @@ -221,6 +232,7 @@ public void testLatin7Encoding() * * @throws java.io.IOException if any. */ + @Test public void testLatin15Encoding() throws IOException { @@ -232,6 +244,7 @@ public void testLatin15Encoding() * * @throws java.io.IOException if any. */ + @Test public void testEUC_JPEncoding() throws IOException { @@ -243,6 +256,7 @@ public void testEUC_JPEncoding() * * @throws java.io.IOException if any. */ + @Test public void testEBCDICEncoding() throws IOException { @@ -254,18 +268,15 @@ public void testEBCDICEncoding() * * @throws java.io.IOException if any. */ + @Test public void testInappropriateEncoding() throws IOException { - try - { - checkXmlStreamReader( TEXT_UNICODE, "ISO-8859-2" ); - fail( "Check should have failed, since some characters are not available in the specified encoding" ); - } - catch ( ComparisonFailure cf ) - { - // expected failure, since the encoding does not contain some characters - } + // expected failure, since the encoding does not contain some characters + assertThrows(AssertionFailedError.class, () -> + checkXmlStreamReader( TEXT_UNICODE, "ISO-8859-2" ), + "Check should have failed, since some characters are not available in the specified encoding" + ); } /** @@ -273,6 +284,7 @@ public void testInappropriateEncoding() * * @throws java.io.IOException if any. */ + @Test public void testEncodingAttribute() throws IOException { diff --git a/src/test/java/org/codehaus/plexus/util/xml/XmlStreamWriterTest.java b/src/test/java/org/codehaus/plexus/util/xml/XmlStreamWriterTest.java index fa13aaa0..b699f732 100644 --- a/src/test/java/org/codehaus/plexus/util/xml/XmlStreamWriterTest.java +++ b/src/test/java/org/codehaus/plexus/util/xml/XmlStreamWriterTest.java @@ -1,7 +1,5 @@ package org.codehaus.plexus.util.xml; -import static org.junit.Assert.assertEquals; - /* * Copyright The Codehaus Foundation. * @@ -21,7 +19,9 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; -import org.junit.Test; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; /** *

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 bb564ad5..3b54f16f 100644 --- a/src/test/java/org/codehaus/plexus/util/xml/XmlUtilTest.java +++ b/src/test/java/org/codehaus/plexus/util/xml/XmlUtilTest.java @@ -16,9 +16,6 @@ * limitations under the License. */ -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -30,7 +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.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 145f0f10..eb8041f7 100644 --- a/src/test/java/org/codehaus/plexus/util/xml/XmlWriterUtilTest.java +++ b/src/test/java/org/codehaus/plexus/util/xml/XmlWriterUtilTest.java @@ -16,17 +16,16 @@ * limitations under the License. */ -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import java.io.ByteArrayOutputStream; import java.io.OutputStream; 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.jupiter.api.Assertions.*; /** *

XmlWriterUtilTest class.

@@ -48,7 +47,7 @@ public class XmlWriterUtilTest * * @throws java.lang.Exception if any. */ - @Before + @BeforeEach public void setUp() throws Exception { @@ -62,7 +61,7 @@ public void setUp() * * @throws java.lang.Exception if any. */ - @After + @AfterEach public void tearDown() throws Exception { 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 3d3cb5ec..bd696d62 100644 --- a/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomBuilderTest.java +++ b/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomBuilderTest.java @@ -16,10 +16,6 @@ * limitations under the License. */ -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - import java.io.IOException; import java.io.StringReader; import java.io.StringWriter; @@ -27,7 +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.jupiter.api.Assertions.*; /** * Test the Xpp3DomBuilder. @@ -55,7 +53,7 @@ public void testBuildFromReader() Xpp3Dom expectedDom = createExpectedDom(); - assertEquals( "check DOMs match", expectedDom, dom ); + assertEquals( expectedDom, dom, "check DOMs match" ); } /** @@ -71,11 +69,11 @@ public void testBuildTrimming() 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" ); } /** @@ -132,10 +130,10 @@ else if ( "root".equals( rawName ) ) 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" ); } /** @@ -173,13 +171,13 @@ public void testEscapingInContent() { 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" ); } /** @@ -195,12 +193,12 @@ public void testEscapingInAttributes() String s = getAttributeEncodedString(); Xpp3Dom dom = Xpp3DomBuilder.build( new StringReader( s ) ); - assertEquals( "Check attribute value", "", dom.getChild( "el" ).getAttribute( "att" ) ); + assertEquals( "", dom.getChild( "el" ).getAttribute( "att" ), "Check attribute value" ); StringWriter w = new StringWriter(); Xpp3DomWriter.write( w, dom ); String newString = w.toString(); - assertEquals( "Compare stringified DOMs", newString, s ); + assertEquals( newString, s, "Compare stringified DOMs" ); } /** @@ -222,18 +220,18 @@ public Object toInputLocation( XmlPullParser parser ) }; Xpp3Dom dom = Xpp3DomBuilder.build( new StringReader( createDomString() ), true, ilb ); Xpp3Dom expectedDom = createExpectedDom(); - assertEquals( "root input location", expectedDom.getInputLocation(), dom.getInputLocation() ); + assertEquals( expectedDom.getInputLocation(), dom.getInputLocation(), "root input location" ); for( int i = 0; i < dom.getChildCount(); i++ ) { Xpp3Dom elt = dom.getChild( i ); Xpp3Dom expectedElt = expectedDom.getChild( i ); - assertEquals( elt.getName() + " input location", expectedElt.getInputLocation(), elt.getInputLocation() ); + assertEquals( expectedElt.getInputLocation(), elt.getInputLocation(), elt.getName() + " input location" ); if ( "el2".equals( elt.getName() ) ) { Xpp3Dom el3 = elt.getChild( 0 ); Xpp3Dom expectedEl3 = expectedElt.getChild( 0 ); - assertEquals( el3.getName() + " input location", expectedEl3.getInputLocation(), el3.getInputLocation() ); + assertEquals( expectedEl3.getInputLocation(), el3.getInputLocation(), el3.getName() + " input location" ); } } } diff --git a/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomTest.java b/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomTest.java index ec4f4ee3..5dbdc2c3 100644 --- a/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomTest.java +++ b/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomTest.java @@ -16,14 +16,6 @@ * limitations under the License. */ -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; - import java.io.IOException; import java.io.StringReader; import java.util.ArrayList; @@ -35,7 +27,9 @@ import org.apache.maven.internal.xml.XmlNodeImpl; 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.jupiter.api.Assertions.*; /** *

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 74c08baf..0f700dd2 100644 --- a/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomUtilsTest.java +++ b/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomUtilsTest.java @@ -16,15 +16,14 @@ * limitations under the License. */ -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - import java.io.IOException; import java.io.StringReader; 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.jupiter.api.Assertions.*; /** *

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 93c00a7d..8076b37f 100644 --- a/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomWriterTest.java +++ b/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomWriterTest.java @@ -16,11 +16,11 @@ * limitations under the License. */ -import static org.junit.Assert.assertEquals; - import java.io.StringWriter; -import org.junit.Test; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; /** *

Xpp3DomWriterTest class.

@@ -43,7 +43,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" ); } /** @@ -56,7 +56,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 458d800f..0d183346 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 @@ -1,15 +1,15 @@ package org.codehaus.plexus.util.xml.pull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - import java.io.File; import java.io.FileReader; 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.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 @@ public class IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMX /** *

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 92998db9..4cb0a8ce 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 @@ -1,8 +1,5 @@ package org.codehaus.plexus.util.xml.pull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -15,8 +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.Test; +import org.junit.jupiter.api.BeforeEach; + +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. @@ -36,7 +36,7 @@ public class IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMX /** *

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 a6a80030..9a877456 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 @@ -1,15 +1,15 @@ package org.codehaus.plexus.util.xml.pull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - import java.io.File; import java.io.FileReader; 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.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 @@ public class IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMX /** *

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 639f1589..2d697b02 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 @@ -1,17 +1,17 @@ package org.codehaus.plexus.util.xml.pull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.Reader; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.BeforeEach; + +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 IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMX /** *

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 e5510bb5..7d7fc20a 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 @@ -1,15 +1,15 @@ package org.codehaus.plexus.util.xml.pull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - import java.io.File; import java.io.FileReader; 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.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 @@ public class IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMX /** *

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 e0d77330..e5754180 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 @@ -16,14 +16,8 @@ * limitations under the License. */ -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - import java.io.EOFException; import java.io.File; -import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -35,7 +29,9 @@ import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.xml.XmlStreamReader; -import org.junit.Test; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; /** *

MXParserTest class.

@@ -1132,8 +1128,8 @@ public void testEncodingUTF8_newXmlReader() 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 7d2f6299..8c174f54 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 @@ -1,16 +1,17 @@ package org.codehaus.plexus.util.xml.pull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - import java.io.File; import java.io.FileInputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; 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.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 +32,7 @@ public class eduni_misc_Test_BjoernHoehrmannviaHST2013_09_18_Test /** *

setUp.

*/ - @Before + @BeforeEach public void setUp() { parser = new MXParser(); @@ -271,7 +272,7 @@ public void testhst_lhs_009() } catch ( XmlPullParserException e ) { - assertTrue( e.getMessage(), e.getMessage().contains( "UTF-16 BOM in a UTF-8 encoded file is incompatible" ) ); + assertTrue( e.getMessage().contains( "UTF-16 BOM in a UTF-8 encoded file is incompatible" ), e.getMessage() ); } }