GenericXMLHandler implements Cloneable { public boolean xPathExists(String xpathExpr) { try { return !(XPath.selectSingleNode(this.xmlDocument, xpathExpr) == null); } catch (Exception ex) { return false; } } GenericXMLHandler();  GenericXMLHandler(File xmlFile);  GenericXMLHandler(String xmlFile); void SetElementText(String xPathExpression, String value); void SetElementAttribute(String xPathExpression, String attribute, String value); String GetElementText(String xPathExpression); String GetElementAttr(String xPathExpression); ArrayList<String> GetElementList(String xPathExpression); boolean xPathExists(String xpathExpr); String toString(); void Save(); boolean isXMLValid(); Object clone(); String getParentPath(String xpath); String getCurrentPath(String xpath, int node); String getChildNode(String xpath); String getCurrentNamespace(String xpath); void setNamespace(String name, String value);  }
@Test @Disabled public void testXPathExists_1() throws Exception { GenericXMLHandler fixture = new GenericXMLHandler(new File("")); fixture.namespaces = new HashMap(); fixture.xml = ""; fixture.xmlDocument = new Document(); String xpathExpr = ""; boolean result = fixture.xPathExists(xpathExpr); assertTrue(!result); }
@Test @Disabled public void testXPathExists_2() throws Exception { GenericXMLHandler fixture = new GenericXMLHandler(new File("src/test/resources/tt.xml")); fixture.namespaces = new HashMap(); String xpathExpr = "testPlan/testSuite"; boolean result = fixture.xPathExists(xpathExpr); assertTrue(result); }