Description { public String summarize(int length) { String everything = joinText(" "); if(everything.length() <= length) { return everything; } return everything.substring(0, length); } Description();  Description(String text);  Description(List<Paragraph> paragraphs); boolean hasText(); String summarize(int length); String joinText(String between); List<Paragraph> getParagraphs(); void setParagraphs(List<Paragraph> paragraphs); @Override String toString(); String toHtml();  }
@Test public void testSummarize() { Description desc = new Description(); assertTrue(desc.summarize(4).isEmpty()); desc.getParagraphs().add(new Paragraph("12")); assertEquals("12",desc.summarize(4)); desc.getParagraphs().add(new Paragraph("3456")); assertEquals("12 3",desc.summarize(4)); }