PElement extends PComplexPanel { @Override public String dumpDOM() { StringBuilder builder = new StringBuilder(); builder.append("<"); builder.append(tagName); builder.append(" pid=\"" + ID + "\""); if (!isVisible()) builder.append(" hidden"); builder.append(" class=\"" + getStyleNames().collect(Collectors.joining(" ")) + "\""); builder.append(">"); if (getWidgetCount() == 0) { if (innerText != null) builder.append(innerText); else builder.append(innerHTML); } else { builder.append(dumpChildDOM()); } builder.append("</" + tagName + ">"); return builder.toString(); } protected  PElement(final String tagName); String getTagName(); String getInnerText(); void setInnerText(final String innerText); String getInnerHTML(); void setInnerHTML(final String innerHTML); @Override String dumpDOM();  }
@Test public void testDumpDOM() { final PElement w = new PElement("span"); w.setStyleName("t"); w.setInnerText("test"); PWindow.getMain().add(w); Document document = Jsoup.parse(w.dumpDOM()); assertEquals("test", document.getElementsByClass("t").get(0).text()); }