@Test public void testHasXPath_shouldFailed() { thrown.expectAssertionError(format("Expecting:%n <entry>%nto have XPath: <./abc>")); String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<feed>" + " <title>title</title>" + " <entry attr=\"value\">" + " <title>title1</title>" + " </entry>" + "</feed>"; assertThat(xml) .nodesByXPath("/feed/entry") .first() .hasXPath("./abc"); }
public SingleNodeAssert hasXPath(String xPath) { isNotNull(); if (isNodeSetEmpty(xPath)) { throwAssertionError(shouldHaveXPath(actual.getNodeName(), xPath)); } return this; }
SingleNodeAssert extends AbstractAssert<SingleNodeAssert, Node> { public SingleNodeAssert hasXPath(String xPath) { isNotNull(); if (isNodeSetEmpty(xPath)) { throwAssertionError(shouldHaveXPath(actual.getNodeName(), xPath)); } return this; } }
SingleNodeAssert extends AbstractAssert<SingleNodeAssert, Node> { public SingleNodeAssert hasXPath(String xPath) { isNotNull(); if (isNodeSetEmpty(xPath)) { throwAssertionError(shouldHaveXPath(actual.getNodeName(), xPath)); } return this; } SingleNodeAssert(Node node, JAXPXPathEngine engine); }
SingleNodeAssert extends AbstractAssert<SingleNodeAssert, Node> { public SingleNodeAssert hasXPath(String xPath) { isNotNull(); if (isNodeSetEmpty(xPath)) { throwAssertionError(shouldHaveXPath(actual.getNodeName(), xPath)); } return this; } SingleNodeAssert(Node node, JAXPXPathEngine engine); SingleNodeAssert hasAttribute(String attributeName); SingleNodeAssert hasAttribute(String attributeName, String attributeValue); SingleNodeAssert doesNotHaveAttribute(String attributeName); SingleNodeAssert doesNotHaveAttribute(String attributeName, String attributeValue); SingleNodeAssert hasXPath(String xPath); }
SingleNodeAssert extends AbstractAssert<SingleNodeAssert, Node> { public SingleNodeAssert hasXPath(String xPath) { isNotNull(); if (isNodeSetEmpty(xPath)) { throwAssertionError(shouldHaveXPath(actual.getNodeName(), xPath)); } return this; } SingleNodeAssert(Node node, JAXPXPathEngine engine); SingleNodeAssert hasAttribute(String attributeName); SingleNodeAssert hasAttribute(String attributeName, String attributeValue); SingleNodeAssert doesNotHaveAttribute(String attributeName); SingleNodeAssert doesNotHaveAttribute(String attributeName, String attributeValue); SingleNodeAssert hasXPath(String xPath);  }