TableRow { public String toHtml() { StringBuffer sb = new StringBuffer("<tr>"); for (TableData td : columns) { sb.append(td.toHtml()); } sb.append("</tr>"); return sb.toString(); } TableRow();  TableRow(List<TableData> tableData); List<TableData> getColumns(); void setColumns(List<TableData> columns); @Override String toString(); String toHtml();  }
@Test public void testToHtml() { TableRow tr = new TableRow(); assertEquals("<tr></tr>",tr.toHtml()); tr.setColumns(columns); assertEquals("<tr></tr>",tr.toHtml()); tr.getColumns().add(new TableData("foo")); assertEquals("<tr><td>foo</td></tr>",tr.toHtml()); }