We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a5a5760 commit ad50d1dCopy full SHA for ad50d1d
hamcrest/src/test/java/org/hamcrest/xml/HasXPathTest.java
@@ -92,6 +92,21 @@ public Iterator<String> getPrefixes(String namespaceURI) {
92
assertMatches(hasXPath("/books/book/isbn", equalTo("A-ISBN")), multipleBookXml);
93
}
94
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
110
@Test public void
111
matchesEmptyElement() {
112
assertMatches(hasXPath("//emptySomething"), xml);
0 commit comments