@Test public void testXPathIsFoundInDocumentWithASingleOccurence() throws Exception { String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<feed>" + " <title>title</title>" + " <entry>" + " <title>title1</title>" + " <id>id1</id>" + " </entry>" + "</feed>"; Element xmlRootElement = db.parse( new InputSource(new ByteArrayInputStream(xml.getBytes("utf-8")))).getDocumentElement(); assertThat(xmlRootElement, hasXPath("entry/id")); assertThat(xmlRootElement, hasXPath("entry/title")); assertThat(xmlRootElement, not(hasXPath("entry/description"))); }
@Factory public static HasXPathMatcher hasXPath(String xPath) { return new HasXPathMatcher(xPath); }
HasXPathMatcher extends BaseMatcher<Object> { @Factory public static HasXPathMatcher hasXPath(String xPath) { return new HasXPathMatcher(xPath); } }
HasXPathMatcher extends BaseMatcher<Object> { @Factory public static HasXPathMatcher hasXPath(String xPath) { return new HasXPathMatcher(xPath); } HasXPathMatcher(String xPath); }
HasXPathMatcher extends BaseMatcher<Object> { @Factory public static HasXPathMatcher hasXPath(String xPath) { return new HasXPathMatcher(xPath); } HasXPathMatcher(String xPath); HasXPathMatcher withDocumentBuilderFactory(DocumentBuilderFactory f); HasXPathMatcher withXPathFactory(XPathFactory f); @Override boolean matches(Object object); @Override void describeTo(Description description); @Override void describeMismatch(Object item, Description mismatchDescription); @Factory static HasXPathMatcher hasXPath(String xPath); HasXPathMatcher withNamespaceContext(Map<String, String> prefix2Uri); }
HasXPathMatcher extends BaseMatcher<Object> { @Factory public static HasXPathMatcher hasXPath(String xPath) { return new HasXPathMatcher(xPath); } HasXPathMatcher(String xPath); HasXPathMatcher withDocumentBuilderFactory(DocumentBuilderFactory f); HasXPathMatcher withXPathFactory(XPathFactory f); @Override boolean matches(Object object); @Override void describeTo(Description description); @Override void describeMismatch(Object item, Description mismatchDescription); @Factory static HasXPathMatcher hasXPath(String xPath); HasXPathMatcher withNamespaceContext(Map<String, String> prefix2Uri);  }