Update xmlunit library to version 2.1.0

xmlunit 2.1.0 is the latest release for xmlunit.
Most of the xmlunit functionality used within spring-framework
was done through the xmlunit 1.x helper class
`org.custommonkey.xmlunit.XMLAssert`.

As of xmlunit 2.0.0 most of the XML comparison methods are done
through hamcrest matchers exposed by the xmlunit-matchers
library. In some cases during the migration, the matchers
had to be customized with custom `NodeMatcher` or
`DifferenceEvaluator` instances in order to keep the assertions
correct (they were performed with xmlunit 1.x previously).

Issue: SPR-14043
This commit is contained in:
Marius Grama
2016-03-13 15:33:15 +01:00
committed by Brian Clozel
parent 9fb8a2eb2e
commit 3635c9dbfe
22 changed files with 345 additions and 284 deletions

View File

@@ -16,21 +16,24 @@
package org.springframework.messaging.converter;
import static org.junit.Assert.*;
import static org.xmlunit.diff.ComparisonType.*;
import static org.xmlunit.diff.DifferenceEvaluators.*;
import static org.xmlunit.matchers.CompareMatcher.*;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import javax.xml.bind.annotation.XmlRootElement;
import org.junit.Before;
import org.junit.Test;
import org.xmlunit.diff.DifferenceEvaluator;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.oxm.jaxb.Jaxb2Marshaller;
import static org.custommonkey.xmlunit.XMLAssert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
/**
* @author Arjen Poutsma
*/
@@ -82,7 +85,8 @@ public class MarshallingMessageConverterTests {
assertNotNull(message);
String actual = new String((byte[]) message.getPayload(), StandardCharsets.UTF_8);
assertXMLEqual("<myBean><name>Foo</name></myBean>", actual);
DifferenceEvaluator ev = chain(Default, downgradeDifferencesToEqual(XML_STANDALONE));
assertThat(actual, isSimilarTo("<myBean><name>Foo</name></myBean>").withDifferenceEvaluator(ev));
}