This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git
The following commit(s) were added to refs/heads/main by this push:
new b91b1668f7 Upgrade XMLUnit from 1.6 to xmlunit-core 2.11.0 (#6905)
b91b1668f7 is described below
commit b91b1668f767956e51aa7dade14cf6d18eaec762
Author: Lance <[email protected]>
AuthorDate: Tue Mar 31 03:16:24 2026 +0800
Upgrade XMLUnit from 1.6 to xmlunit-core 2.11.0 (#6905)
Signed-off-by: lance <[email protected]>
---
core/pom.xml | 4 +-
.../org/apache/hop/core/xml/XmlFormatterTest.java | 53 +++++++++++++++-------
lib/pom.xml | 7 +--
3 files changed, 42 insertions(+), 22 deletions(-)
diff --git a/core/pom.xml b/core/pom.xml
index 0877df7c52..401947e596 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -372,8 +372,8 @@
</dependency>
<dependency>
- <groupId>xmlunit</groupId>
- <artifactId>xmlunit</artifactId>
+ <groupId>org.xmlunit</groupId>
+ <artifactId>xmlunit-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/core/src/test/java/org/apache/hop/core/xml/XmlFormatterTest.java
b/core/src/test/java/org/apache/hop/core/xml/XmlFormatterTest.java
index 60aaaf9209..f99ae40562 100644
--- a/core/src/test/java/org/apache/hop/core/xml/XmlFormatterTest.java
+++ b/core/src/test/java/org/apache/hop/core/xml/XmlFormatterTest.java
@@ -16,25 +16,19 @@
*/
package org.apache.hop.core.xml;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.IOUtils;
-import org.custommonkey.xmlunit.Diff;
-import org.custommonkey.xmlunit.XMLUnit;
-import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import org.xmlunit.builder.DiffBuilder;
+import org.xmlunit.diff.Diff;
/** Unit test for {@link XmlFormatter} */
class XmlFormatterTest {
- @BeforeAll
- static void setupClass() {
- XMLUnit.setIgnoreWhitespace(true);
- }
-
@Test
void test1() throws Exception {
String inXml, expectedXml;
@@ -48,8 +42,14 @@ class XmlFormatterTest {
}
String result = XmlFormatter.format(inXml);
- Diff diff = XMLUnit.compareXML(expectedXml, result);
- assertTrue(diff.similar(), "XML documents are not equal: " +
diff.toString());
+ Diff diff =
+ DiffBuilder.compare(expectedXml)
+ .withTest(result)
+ .ignoreWhitespace()
+ .checkForSimilar()
+ .build();
+
+ assertFalse(diff.hasDifferences(), "XML documents are not equal: " + diff);
}
@Test
@@ -66,8 +66,14 @@ class XmlFormatterTest {
}
String result = XmlFormatter.format(inXml);
- Diff diff = XMLUnit.compareXML(expectedXml, result);
- assertTrue(diff.similar(), "XML documents are not equal: " +
diff.toString());
+ Diff diff =
+ DiffBuilder.compare(expectedXml)
+ .withTest(result)
+ .ignoreWhitespace()
+ .checkForSimilar()
+ .build();
+
+ assertFalse(diff.hasDifferences(), "XML documents are not equal: " + diff);
}
@Test
@@ -85,8 +91,14 @@ class XmlFormatterTest {
}
String result = XmlFormatter.format(inXml);
- Diff diff = XMLUnit.compareXML(expectedXml, result);
- assertTrue(diff.similar(), "XML documents are not equal: " +
diff.toString());
+ Diff diff =
+ DiffBuilder.compare(expectedXml)
+ .withTest(result)
+ .ignoreWhitespace()
+ .checkForSimilar()
+ .build();
+
+ assertFalse(diff.hasDifferences(), "XML documents are not equal: " + diff);
}
@Test
@@ -104,7 +116,14 @@ class XmlFormatterTest {
}
String result = XmlFormatter.format(inXml);
- Diff diff = XMLUnit.compareXML(expectedXml, result);
- assertTrue(diff.similar(), "XML documents are not equal: " +
diff.toString());
+ Diff diff =
+ DiffBuilder.compare(expectedXml)
+ .withTest(result)
+ .ignoreWhitespace()
+ .ignoreComments()
+ .checkForSimilar()
+ .build();
+
+ assertFalse(diff.hasDifferences(), "XML documents are not equal: " + diff);
}
}
diff --git a/lib/pom.xml b/lib/pom.xml
index ccfc8377d3..66c49ee7ad 100644
--- a/lib/pom.xml
+++ b/lib/pom.xml
@@ -142,7 +142,7 @@
<woodstox.version>7.1.1</woodstox.version>
<xerces.version>2.12.2</xerces.version>
<xml-apis-ext.version>1.3.04</xml-apis-ext.version>
- <xmlunit.version>1.6</xmlunit.version>
+ <xmlunit.version>2.11.0</xmlunit.version>
<xstream.version>1.4.21</xstream.version>
<zstd-jni.version>1.5.7-7</zstd-jni.version>
</properties>
@@ -811,9 +811,10 @@
<version>${xml-apis-ext.version}</version>
</dependency>
<dependency>
- <groupId>xmlunit</groupId>
- <artifactId>xmlunit</artifactId>
+ <groupId>org.xmlunit</groupId>
+ <artifactId>xmlunit-core</artifactId>
<version>${xmlunit.version}</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>