@Test public void hasText() {

    Document doc = Jsoup.parse("<div><p>Hello</p></div><div><p></p></div>");
    Elements divs = doc.select("div");
    assertTrue(divs.hasText());
    assertFalse(doc.select("div + div").hasText());
}