Description { public String joinText(String between) { StringBuffer sb = new StringBuffer(); if (this.paragraphs != null) { for (Iterator<Paragraph> iterator = this.paragraphs.iterator(); iterator.hasNext();) { sb.append(iterator.next().getText()); if (iterator.hasNext()) { sb.append(between); } } } return sb.toString(); } 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 testJoinText() { Description desc = new Description(); assertTrue(desc.joinText(", ").isEmpty()); desc.getParagraphs().add(new Paragraph("one")); assertEquals("one", desc.joinText(", ")); desc.getParagraphs().add(new Paragraph("two")); assertEquals("one, two", desc.joinText(", ")); }