Skip to content

Commit

Permalink
Merge pull request #183 from apache/refactoring/UIMA-6321-Upgrade-to-…
Browse files Browse the repository at this point in the history
…xmlunit-2

[UIMA-6321] Upgrade to xmlunit 2
  • Loading branch information
reckart committed Feb 18, 2022
2 parents 2e05fbb + 3999d4d commit 3b08788
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@
import org.apache.uima.util.XMLSerializer;
import org.apache.uima.util.impl.ProcessTrace_impl;
import org.assertj.core.api.AutoCloseableSoftAssertions;
import org.custommonkey.xmlunit.XMLAssert;
import org.junit.jupiter.api.Test;
import org.xml.sax.ContentHandler;
import org.xmlunit.assertj3.XmlAssert;

/**
* Tests the TextAnalysisEngine_impl class.
Expand Down Expand Up @@ -1729,7 +1729,7 @@ private void manyDelegatesCommon() throws Exception {

String inXml = FileCompare.file2String(inFile);
String cloneXml = FileCompare.file2String(cloneFile);
XMLAssert.assertXMLEqual(inXml, cloneXml);
XmlAssert.assertThat(cloneXml).and(inXml).areIdentical();
// When building from a source distribution the descriptor may not have
// appropriate line-ends so compute the length as if always 1 byte.
int diff = fileLength(cloneFile) - fileLength(inFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@
import org.apache.uima.test.junit_extension.JUnitExtension;
import org.apache.uima.testTypeSystem_arrays.OfShorts;
import org.apache.uima.testTypeSystem_arrays.OfStrings;
import org.custommonkey.xmlunit.XMLAssert;
import org.custommonkey.xmlunit.XMLUnit;
import org.junit.jupiter.api.Test;
import org.xmlunit.assertj3.XmlAssert;

public class CasToInlineXmlTest {

Expand Down Expand Up @@ -160,14 +159,8 @@ public void testCasToInlineXml() throws Exception {
break;
}
}
boolean whitespaceFlag = XMLUnit.getIgnoreWhitespace();
XMLUnit.setIgnoreWhitespace(true);
try {
XMLAssert.assertXMLEqual(expected, result);
} finally {
XMLUnit.setIgnoreWhitespace(whitespaceFlag);
}
// assertEquals(expected, result.trim());

XmlAssert.assertThat(result).and(expected).ignoreWhitespace().areIdentical();
}

private String canonicalizeNl(String s) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@
import org.apache.uima.util.XMLInputSource;
import org.apache.uima.util.XMLParser;
import org.apache.uima.util.XMLSerializer;
import org.custommonkey.xmlunit.XMLAssert;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.xml.sax.SAXException;
import org.xmlunit.assertj3.XmlAssert;

public class JsonCasSerializerTest {
// @formatter:off
Expand Down Expand Up @@ -584,7 +584,7 @@ private void compareWithExpected(String expectedResultsName, String r)
if (doJson) {
assertEquals(ce, r);
} else {
XMLAssert.assertXMLEqual(ce, r);
XmlAssert.assertThat(r).and(ce).areIdentical();
}
}

Expand Down
12 changes: 9 additions & 3 deletions uimaj-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
<jackson-version>2.13.1</jackson-version>
<junit-version>5.8.2</junit-version>
<assertj-version>3.22.0</assertj-version>
<xmlunit-version>2.9.0</xmlunit-version>

<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down Expand Up @@ -190,9 +191,14 @@
<version>${slf4j-version}</version>
</dependency>
<dependency>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
<version>1.6</version>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-core</artifactId>
<version>${xmlunit-version}</version>
</dependency>
<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-assertj3</artifactId>
<version>${xmlunit-version}</version>
</dependency>
<dependency>
<groupId>${eclipseP2RepoId}</groupId>
Expand Down
10 changes: 8 additions & 2 deletions uimaj-test-util/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,14 @@
<scope>compile</scope> <!-- is normally test scope, so need to be explicit -->
</dependency>
<dependency>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-core</artifactId>
<version>${xmlunit-version}</version>
</dependency>
<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-assertj3</artifactId>
<version>${xmlunit-version}</version>
</dependency>
</dependencies>
</project>

0 comments on commit 3b08788

Please sign in to comment.