### Question:
HasXPath { private HasXPath() { } private  HasXPath(); static TypeSafeMatcher<String> hasXPath(String xPath, Matcher<String> matcher); static TypeSafeMatcher<String> hasXPath(String xPath);  }### Answer:
@Test public void xmlMatchesStringWithValue() { TypeSafeMatcher<String> xPathMatcher = HasXPath.hasXPath(" assertThat(xPathMatcher.matches("<elementName>value</elementName>"), is(true)); }
@Test public void xmlMatchesString() { TypeSafeMatcher<String> xPathMatcher = HasXPath.hasXPath(" assertThat(xPathMatcher.matches("<elementName>something else</elementName>"), is(true)); }
@Test public void xmlMatchesWithNestedMatcher() { TypeSafeMatcher<String> xPathMatcher = HasXPath.hasXPath(" assertThat(xPathMatcher.matches("<elementName>blah</elementName>"), is(true)); }
@Test public void xmlDoesNotMatch() { TypeSafeMatcher<String> xPathMatcher = HasXPath.hasXPath("/node"); assertThat(xPathMatcher.matches("<cat><node></node></cat>"), is(false)); }