Paragraph { public boolean hasText() { return this.text != null && !this.text.isEmpty(); } Paragraph();  Paragraph(String text); boolean hasText(); String getText(); void setText(String text); @Override String toString(); String toHtml();  }
@Test public void testHasText() { Paragraph p = new Paragraph(); assertFalse(p.hasText()); p.setText(""); assertFalse(p.hasText()); p.setText("x"); assertTrue(p.hasText()); }