### Question:
WriteDataResultHtmlRenderer implements Renderer<WriteDataResult, HtmlFragment> { @Override public HtmlFragment render(final WriteDataResult r) { final int inserts = r.getWrittenRowCount(); final int updates = r.getUpdatesCount(); final int errors = r.getErrorRowCount(); final int total = inserts + updates + errors; final Datastore datastore = (_configuration == null ? null : r.getDatastore(_configuration.getDatastoreCatalog())); final StringBuilder sb = new StringBuilder("<div>"); if (datastore != null) { sb.append("\n <p>"); if (total == 0) { sb.append("No data"); } else { sb.append("Data"); } sb.append(" written to <span class=\"datastoreName\">"); sb.append(datastore.getName()); sb.append("</span></p>"); } if (inserts > 0) { sb.append("\n <p>Executed "); sb.append(inserts); sb.append(" inserts</p>"); } if (updates > 0) { sb.append("\n <p>Executed "); sb.append(updates); sb.append(" updates</p>"); } if (errors > 0) { sb.append("\n <p>"); sb.append(errors); sb.append(" Erroneous records</p>"); } sb.append("\n</div>"); final SimpleHtmlFragment frag = new SimpleHtmlFragment(); frag.addBodyElement(sb.toString()); return frag; }  @Override RendererPrecedence getPrecedence(final WriteDataResult renderable); void setConfiguration(final DataCleanerConfiguration configuration); @Override HtmlFragment render(final WriteDataResult r);  }### Answer:
@Test public void testRendering() { final WriteDataResult result = new WriteDataResultImpl(2, 3, "datastore", "schema", "table"); final WriteDataResultHtmlRenderer renderer = new WriteDataResultHtmlRenderer(); final HtmlFragment htmlFragment = renderer.render(result); Assert.assertEquals(0, htmlFragment.getHeadElements().size()); Assert.assertEquals(1, htmlFragment.getBodyElements().size()); final HtmlRenderingContext context = new DefaultHtmlRenderingContext(); Assert.assertEquals("<div>\n <p>Executed 2 inserts</p>\n <p>Executed 3 updates</p>\n</div>", htmlFragment.getBodyElements().get(0).toHtml(context).replaceAll("\r\n", "\n")); }