use of io.restassured.path.xml.element.NodeChildren in project rest-assured by rest-assured.
the class XmlPathTest method convertsNonRootObjectGraphToJavaObjects.
@Test
public void convertsNonRootObjectGraphToJavaObjects() throws Exception {
NodeChildren categories = with(XML).get("shopping.category");
assertThat(categories.size(), equalTo(3));
assertThat(categories.toString(), equalTo("Chocolate10Coffee20Paper5Pens15.5Kathryn's Birthday200"));
}
use of io.restassured.path.xml.element.NodeChildren in project rest-assured by rest-assured.
the class XmlPathTest method itemsWithPriceBetweenTenAndTwenty.
@Test
public void itemsWithPriceBetweenTenAndTwenty() throws Exception {
final List<Node> itemsBetweenTenAndTwenty = with(XML).get("shopping.category.item.findAll { item -> def price = item.price.toFloat(); price >= 10 && price <= 20 }");
assertThat(itemsBetweenTenAndTwenty.size(), equalTo(3));
final Node category1 = itemsBetweenTenAndTwenty.get(0);
final NodeChildren categoryChildren = category1.children();
assertThat(categoryChildren, hasItems("Chocolate", "10"));
for (Node item : categoryChildren.nodeIterable()) {
assertThat(item.name(), anyOf(equalTo("name"), equalTo("price")));
}
}
Aggregations