@Test public void testHasText() {

    Document doc = Jsoup.parse("<div><p>Hello</p><p></p></div>");
    Element div = doc.select("div").first();
    Elements ps = doc.select("p");
    assertTrue(div.hasText());
    assertTrue(ps.first().hasText());
    assertFalse(ps.last().hasText());
}