@Test public void testContainsAllNodesHavingXPath_shouldFailed() { thrown.expectAssertionError("check node at index 2"); thrown.expectAssertionError(format("Expecting:%n <entry>%nto have XPath: <./title>")); String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<feed>" + " <title>title</title>" + " <entry>" + " <title>title1</title>" + " </entry>" + " <entry>" + " <title>title1</title>" + " </entry>" + " <entry>" + " <description>description</description>" + " </entry>" + "</feed>"; assertThat(xml) .hasXPath("/feed/entry") .containsAllNodesHavingXPath("./title"); }
public MultipleNodeAssert containsAllNodesHavingXPath(final String xPath) { isNotNull(); allSatisfy(new SingleNodeAssertConsumer() { @Override public void accept(SingleNodeAssert singleNodeAssert) { singleNodeAssert.hasXPath(xPath); } }); return this; }
MultipleNodeAssert extends FactoryBasedNavigableIterableAssert<MultipleNodeAssert, Iterable<Node>, Node, SingleNodeAssert> { public MultipleNodeAssert containsAllNodesHavingXPath(final String xPath) { isNotNull(); allSatisfy(new SingleNodeAssertConsumer() { @Override public void accept(SingleNodeAssert singleNodeAssert) { singleNodeAssert.hasXPath(xPath); } }); return this; } }
MultipleNodeAssert extends FactoryBasedNavigableIterableAssert<MultipleNodeAssert, Iterable<Node>, Node, SingleNodeAssert> { public MultipleNodeAssert containsAllNodesHavingXPath(final String xPath) { isNotNull(); allSatisfy(new SingleNodeAssertConsumer() { @Override public void accept(SingleNodeAssert singleNodeAssert) { singleNodeAssert.hasXPath(xPath); } }); return this; } private  MultipleNodeAssert(Iterable<Node> nodes, JAXPXPathEngine engine); }
MultipleNodeAssert extends FactoryBasedNavigableIterableAssert<MultipleNodeAssert, Iterable<Node>, Node, SingleNodeAssert> { public MultipleNodeAssert containsAllNodesHavingXPath(final String xPath) { isNotNull(); allSatisfy(new SingleNodeAssertConsumer() { @Override public void accept(SingleNodeAssert singleNodeAssert) { singleNodeAssert.hasXPath(xPath); } }); return this; } private  MultipleNodeAssert(Iterable<Node> nodes, JAXPXPathEngine engine); MultipleNodeAssert exist(); void doNotExist(); MultipleNodeAssert haveAttribute(final String attributeName); MultipleNodeAssert haveAttribute(final String attributeName, final String attributeValue); MultipleNodeAssert doNotHaveAttribute(final String attributeName); MultipleNodeAssert doNotHaveAttribute(final String attributeName, final String attributeValue); MultipleNodeAssert containsAnyNodeHavingXPath(String xPath); MultipleNodeAssert containsAllNodesHavingXPath(final String xPath); AbstractListAssert<?, List<? extends String>, String, ObjectAssert<String>> extractingAttribute(String attribute); AbstractListAssert<?, List<? extends String>, String, ObjectAssert<String>> extractingText(); }
MultipleNodeAssert extends FactoryBasedNavigableIterableAssert<MultipleNodeAssert, Iterable<Node>, Node, SingleNodeAssert> { public MultipleNodeAssert containsAllNodesHavingXPath(final String xPath) { isNotNull(); allSatisfy(new SingleNodeAssertConsumer() { @Override public void accept(SingleNodeAssert singleNodeAssert) { singleNodeAssert.hasXPath(xPath); } }); return this; } private  MultipleNodeAssert(Iterable<Node> nodes, JAXPXPathEngine engine); MultipleNodeAssert exist(); void doNotExist(); MultipleNodeAssert haveAttribute(final String attributeName); MultipleNodeAssert haveAttribute(final String attributeName, final String attributeValue); MultipleNodeAssert doNotHaveAttribute(final String attributeName); MultipleNodeAssert doNotHaveAttribute(final String attributeName, final String attributeValue); MultipleNodeAssert containsAnyNodeHavingXPath(String xPath); MultipleNodeAssert containsAllNodesHavingXPath(final String xPath); AbstractListAssert<?, List<? extends String>, String, ObjectAssert<String>> extractingAttribute(String attribute); AbstractListAssert<?, List<? extends String>, String, ObjectAssert<String>> extractingText();  }