Skip to content

Commit ad50d1d

Browse files
committed
Added one more testcase to multiple element xml matcher
1 parent a5a5760 commit ad50d1d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Diff for: hamcrest/src/test/java/org/hamcrest/xml/HasXPathTest.java

+15
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,21 @@ public Iterator<String> getPrefixes(String namespaceURI) {
9292
assertMatches(hasXPath("/books/book/isbn", equalTo("A-ISBN")), multipleBookXml);
9393
}
9494

95+
/*
96+
Test whether the single element case still works or not
97+
*/
98+
@Test public void
99+
appliesMatcherToPathInDocumentWithSingleElement() {
100+
Document multipleBookXml = parse("<books>\n"
101+
+ "<book>\n"
102+
+ "<isbn>A-ISBN</isbn>\n"
103+
+ "</book>\n"
104+
+ "</books>\n"
105+
);
106+
107+
assertMatches(hasXPath("/books/book/isbn", equalTo("A-ISBN")), multipleBookXml);
108+
}
109+
95110
@Test public void
96111
matchesEmptyElement() {
97112
assertMatches(hasXPath("//emptySomething"), xml);

0 commit comments

Comments
 (0)