@Test
public void hasClassTest() {

    Path el = div.that(hasClass("foo"));
    String xpath = el.getXPath().get();
    NodeList nodes = findAllByXpath("<div class=\"not-foo\"></div><div class=\" foo \"></div><span class=\" foo \">abc</span>", el);
    assertThat(nodes.getLength(), is(1));
    assertThat(getCssClass(nodes.item(0)), equalTo(" foo "));
    assertThat(getElementName(nodes.item(0)), equalTo("div"));
    assertThat(el.toString(), is(equalTo("div, that has class foo")));
}