Skip to content

Commit

Permalink
Merge pull request #201 from ihrasko/18.x-bump-xmlunit-to-2.9.1
Browse files Browse the repository at this point in the history
Bump org.xmlunit to 2.9.1
  • Loading branch information
ihrasko authored Nov 14, 2023
2 parents e8afc9d + f7e1004 commit d91aea7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 29 deletions.
13 changes: 0 additions & 13 deletions examples/devices/lighty-network-topology-device/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,5 @@
<artifactId>xmlunit-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-matchers</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-assertj</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

</project>

Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

import static io.lighty.netconf.device.topology.TestUtils.xmlFileToInputStream;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
import static org.xmlunit.assertj.XmlAssert.assertThat;

import io.lighty.netconf.device.utils.TimeoutUtil;
import io.netty.channel.nio.NioEventLoopGroup;
Expand Down Expand Up @@ -44,6 +44,10 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import org.xmlunit.builder.DiffBuilder;
import org.xmlunit.builder.Input;
import org.xmlunit.diff.DefaultNodeMatcher;
import org.xmlunit.diff.ElementSelectors;

public class DeviceTest {

Expand Down Expand Up @@ -236,9 +240,14 @@ private NetconfMessage sendRequestToDevice(String requestFileName,

private void assertResponseIsIdentical(final NetconfMessage response, final InputStream comparedResponse) {
assertNotNull(response);
assertThat(response.getDocument())
.and(comparedResponse)
.ignoreWhitespace()
.areIdentical();
final var actual = Input.fromString(response.toString()).build();
final var expected = Input.fromStream(comparedResponse).build();

final var diff = DiffBuilder.compare(actual).withTest(expected)
.withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byName))
.checkForIdentical()
.ignoreWhitespace()
.build();
assertFalse(diff.hasDifferences(), "XML identical " + diff);
}
}
12 changes: 1 addition & 11 deletions examples/parents/examples-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,7 @@
<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-core</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-matchers</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-assertj</artifactId>
<version>2.7.0</version>
<version>2.9.1</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down

0 comments on commit d91aea7

Please sign in to comment.