XPathAssert { public static void assertEquals(final Document document, final String expression, final String expected) throws XPathExpressionException { final XPathFactory xpathFactory = XPathFactory.newInstance(); final XPath xpath = xpathFactory.newXPath(); final Document doc; if (document instanceof XmlDocument) { final XmlDocument xmldocument = (XmlDocument) document; doc = xmldocument.getDocument(); } else { doc = document; } final String actual = (String) xpath.evaluate(expression, doc, XPathConstants.STRING); Assert.assertEquals(expected, actual); } private  XPathAssert(); static void assertEquals(final Document document,
            final String expression, final String expected); static void assertEquals(final NamespaceContext context,
            final Document document, final String expression,
            final String expected);  }
@Test public void testAssertEqualsText() throws Exception { SsmlDocument document = new SsmlDocument(); final Speak speak = document.getSpeak(); speak.addText("hello world"); XPathAssert.assertEquals(document, "/speak[text()]", "hello world"); }
@Test public void testAssertEqualsAttribute() throws Exception { SsmlDocument document = new SsmlDocument(); final Speak speak = document.getSpeak(); final Audio audio = speak.appendChild(Audio.class); audio.setSrc("test.wav"); XPathAssert.assertEquals(document, "/speak/audio/@src", "test.wav"); }