Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UIMA-6321] Upgrade to xmlunit 2 #183

Merged
merged 1 commit into from
Feb 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>