### Question:
HtmlRenderer { public String render(Gadget gadget) throws RenderingException { try { View view = gadget.getCurrentView(); Collection<PreloadedData> preloads = preloader.preload(gadget); gadget.setPreloads(preloads); String content; if (view.getHref() == null) { content = getViewContent(gadget, view); } else { content = proxyRenderer.render(gadget); } MutableContent mc = new MutableContent(htmlParser, content); for (GadgetRewriter rewriter : gadgetRewritersProvider.getRewriters(gadget.getContext())) { rewriter.rewrite(gadget, mc); } return mc.getContent(); } catch (GadgetException e) { throw new RenderingException(e.getMessage(), e, e.getHttpStatusCode()); } catch (RewritingException e) { throw new RenderingException(e.getMessage(), e, e.getHttpStatusCode()); } } @Inject  HtmlRenderer(PreloaderService preloader,
                      ProxyRenderer proxyRenderer,
                      GadgetRewritersProvider gadgetRewritersProvider,
                      GadgetHtmlParser htmlParser); String render(Gadget gadget); static final String PATH_PARAM; }### Answer:
@Test public void renderPlainTypeHtml() throws Exception { String content = renderer.render(makeGadget(BASIC_HTML_CONTENT)); assertEquals(BASIC_HTML_CONTENT, content); }
@Test public void renderProxied() throws Exception { String content = renderer.render(makeHrefGadget("none")); assertEquals(PROXIED_HTML_CONTENT, content); }
@Test public void doPreloading() throws Exception { renderer.render(makeGadget(BASIC_HTML_CONTENT)); assertTrue("Preloading not performed.", preloaderService.wasPreloaded); }
@Test public void doRewriting() throws Exception { renderer.render(makeGadget(BASIC_HTML_CONTENT)); assertTrue("Rewriting not performed.", captureRewriter.viewWasRewritten()); }