@Test public void testResolveXpath_EmptyResults_NotAllowed() throws Exception { MetadataXpathQuery query = init(create()); Document doc = XmlHelper.createDocument(XML); AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(XML); msg.addMetadata("xpathMetadataKey", " try { MetadataElement result = query.resolveXpath(doc, new XPath(), query.createXpathQuery(msg)); fail(); } catch (CoreException expected) { } }
@Override public MetadataElement resolveXpath(Document doc, XPath xpath, String expr) throws Exception { return new MetadataElement(getMetadataKey(), XpathQueryHelper.resolveSingleTextItem(doc, xpath, expr, allowEmptyResults())); }
MetadataXpathQuery extends MetadataXpathQueryImpl implements XpathQuery { @Override public MetadataElement resolveXpath(Document doc, XPath xpath, String expr) throws Exception { return new MetadataElement(getMetadataKey(), XpathQueryHelper.resolveSingleTextItem(doc, xpath, expr, allowEmptyResults())); } }
MetadataXpathQuery extends MetadataXpathQueryImpl implements XpathQuery { @Override public MetadataElement resolveXpath(Document doc, XPath xpath, String expr) throws Exception { return new MetadataElement(getMetadataKey(), XpathQueryHelper.resolveSingleTextItem(doc, xpath, expr, allowEmptyResults())); } MetadataXpathQuery();  MetadataXpathQuery(String metadataKey, String xpathMetadataKey); }
MetadataXpathQuery extends MetadataXpathQueryImpl implements XpathQuery { @Override public MetadataElement resolveXpath(Document doc, XPath xpath, String expr) throws Exception { return new MetadataElement(getMetadataKey(), XpathQueryHelper.resolveSingleTextItem(doc, xpath, expr, allowEmptyResults())); } MetadataXpathQuery();  MetadataXpathQuery(String metadataKey, String xpathMetadataKey); @Override MetadataElement resolveXpath(Document doc, XPath xpath, String expr); }
MetadataXpathQuery extends MetadataXpathQueryImpl implements XpathQuery { @Override public MetadataElement resolveXpath(Document doc, XPath xpath, String expr) throws Exception { return new MetadataElement(getMetadataKey(), XpathQueryHelper.resolveSingleTextItem(doc, xpath, expr, allowEmptyResults())); } MetadataXpathQuery();  MetadataXpathQuery(String metadataKey, String xpathMetadataKey); @Override MetadataElement resolveXpath(Document doc, XPath xpath, String expr);  }