xpath()
and using that you can get an array using XPath and assert the size
private ResultSequence xPathExpression(String xPathString) {
try {
XPath2Expression expr = new Engine().parseExpression(xPathString, cachedObjects.xpathBuilder);
return expr.evaluate(new DynamicContextBuilder(cachedObjects.xpathBuilder),
new Object[] { cachedObjects.document });
} catch (Exception e) {
throw new XmlAsserterXpathException(xPath(), cachedObjects.xmlAsString, e);
}
}
@Override
public String read() {
String xpath = xPath();
ResultSequence expr = xPathExpression(xpath);
if (expr.empty()) {
throw new XmlAsserterXpathException(xPath(), cachedObjects.xmlAsString);
}
if (expr instanceof ElementType) {
return ((ElementType) expr).getStringValue();
}
throw new UnsupportedOperationException("Can't return values of complex types");
}
ElementType
count
method
...