@Test public void hasAttr() {

    Document doc = Jsoup.parse("<p title=foo><p title=bar><p class=foo><p class=bar>");
    Elements ps = doc.select("p");
    assertTrue(ps.hasAttr("class"));
    assertFalse(ps.hasAttr("style"));
}