XpathResultMatcher supports Hamcrest Matcher NodeList

Use when xpath result is XPathConstants.NODESET
This commit is contained in:
Pat Turner
2018-11-22 19:26:09 +00:00
committed by Rossen Stoyanchev
parent 5ee990e045
commit 6db8306e46
3 changed files with 34 additions and 0 deletions

View File

@@ -48,6 +48,16 @@ public class XpathResultMatchersTests {
new XpathResultMatchers("/foo/bar", null).node(Matchers.nullValue()).match(getStubMvcResult()));
}
@Test
public void nodeList() throws Exception {
new XpathResultMatchers("/foo/bar", null).nodeList(Matchers.notNullValue()).match(getStubMvcResult());
}
@Test(expected = AssertionError.class)
public void nodeListNoMatch() throws Exception {
new XpathResultMatchers("/foo/bar", null).nodeList(Matchers.nullValue()).match(getStubMvcResult());
}
@Test
public void exists() throws Exception {
new XpathResultMatchers("/foo/bar", null).exists().match(getStubMvcResult());