LogEntryComposite implements LogEntryComponent { @Override public String toHtml() { String data = ""; if (mName == null) { data += "<body style=\"background-color:#222222;\">"; } for (LogEntryComponent re : mLogEntryComponents) { data += re.toHtml(); } if (mName == null) { data += "</body>"; } return data; } LogEntryComposite(String name); @Override String toHtml();  }
@Test public void toHtml() throws Exception { LogEntryComposite root = new LogEntryComposite(null); root.append(new TextLeaf("test")); Assert.assertEquals("<body style=\"background-color:#222222;\"><font color='#FFF'>test</font></body>",root.toHtml()); }