MifosImageTag extends TagSupport { public String render() { ResourceBundle resource = getResourceBundle(); path = resource.getString(getId()); XmlBuilder html = new XmlBuilder(); html.startTag("html"); html.startTag("body"); html.singleTag("img", "src", path); html.endTag("body"); html.endTag("html"); return html.toString(); } MifosImageTag(); @Override void setId(final String id); @Override String getId(); void setModuleName(final String name); String getModuleName(); @Override int doStartTag(); String render();  }
@Test public void testRender() throws DocumentException { MifosImageTag mifosImageTag = new MifosImageTag(); String path = "org.mifos.customers.util.resources.customerImages"; mifosImageTag.setModuleName(path); mifosImageTag.setId("3"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("<html>"); stringBuilder.append("<body>"); String str = "\"pages/framework/images/status_activegreen.gif\""; stringBuilder.append("<img src=" + str + " />"); stringBuilder.append("</body>"); stringBuilder.append("</html>"); Assert.assertEquals(stringBuilder.toString(), mifosImageTag.render()); assertWellFormedFragment(mifosImageTag.render()); }