Use XmlUnit to compare XML
diff --git a/modules/jaxws-integration/pom.xml b/modules/jaxws-integration/pom.xml
index 4b26956..f92bafb 100644
--- a/modules/jaxws-integration/pom.xml
+++ b/modules/jaxws-integration/pom.xml
@@ -103,6 +103,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.xmlunit</groupId>
+ <artifactId>xmlunit-assertj3</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-testutils</artifactId>
<version>${project.version}</version>
diff --git a/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SoapMessageMUProviderTests.java b/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SoapMessageMUProviderTests.java
index 2103288..4d90349 100644
--- a/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SoapMessageMUProviderTests.java
+++ b/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SoapMessageMUProviderTests.java
@@ -35,6 +35,7 @@
import org.apache.axis2.testutils.Axis2Server;
import org.junit.ClassRule;
import org.junit.Test;
+import org.xmlunit.assertj3.XmlAssert;
import javax.xml.ws.handler.Handler;
import javax.xml.ws.handler.MessageContext;
@@ -93,16 +94,14 @@
SOAPMessage response = dispatch.invoke(message);
- String string = AttachmentUtil.toString(response);
- assertThat(string).isEqualToIgnoringCase(AttachmentUtil.XML_HEADER
- + AttachmentUtil.msgEnvPlain);
+ XmlAssert.assertThat(response.getSOAPPart().getContent()).and(AttachmentUtil.msgEnvPlain)
+ .areIdentical();
// Try a second time
response = dispatch.invoke(message);
- string = AttachmentUtil.toString(response);
- assertThat(string).isEqualToIgnoringCase(AttachmentUtil.XML_HEADER
- + AttachmentUtil.msgEnvPlain);
+ XmlAssert.assertThat(response.getSOAPPart().getContent()).and(AttachmentUtil.msgEnvPlain)
+ .areIdentical();
}
/**
diff --git a/pom.xml b/pom.xml
index 51f6e15..5a7767f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -492,6 +492,7 @@
<wsdl4j.version>1.6.3</wsdl4j.version>
<xalan.version>2.7.2</xalan.version>
<xmlbeans.version>3.0.1</xmlbeans.version>
+ <xmlunit.version>2.9.1</xmlunit.version>
<xml_resolver.version>1.2</xml_resolver.version>
<commons.cli.version>1.5.0</commons.cli.version>
<!-- The build failing if tests are skipped is very annoying -->
@@ -832,7 +833,12 @@
<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-legacy</artifactId>
- <version>2.9.1</version>
+ <version>${xmlunit.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.xmlunit</groupId>
+ <artifactId>xmlunit-assertj3</artifactId>
+ <version>${xmlunit.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>