### Question:
HeaderWidget implements Renderable { public void render(Object bound, Respond respond) { XmlWidget.writeOpenTag(bound, respond, "head", attribs); respond.write('>'); widgetChain.render(bound, respond); respond.withHtml() .headerPlaceholder(); respond.write("</head>"); } HeaderWidget(WidgetChain widgetChain, Map<String, String> attribs,
                      EvaluatorCompiler compiler); void render(Object bound, Respond respond); Set<T> collect(Class<T> clazz);  }### Answer:
@Test public final void renderHeader() throws ExpressionCompileException { Respond respond = RespondersForTesting.newRespond(); MvelEvaluatorCompiler compiler = new MvelEvaluatorCompiler(Object.class); new HeaderWidget(new ProceedingWidgetChain(), Maps.<String, String>newHashMap(), compiler) .render(new Object(), respond); respond.writeToHead("<title>bs</title>"); final String response = respond.toString(); assert "<head><title>bs</title></head>".equals(response) : "instead printed: " + response; }
@Test public final void renderHeaderWithContent() throws ExpressionCompileException { Respond respond = RespondersForTesting.newRespond(); final WidgetChain widgetChain = new ProceedingWidgetChain(); final EvaluatorCompiler mock = new MvelEvaluatorCompiler(Object.class); widgetChain.addWidget(new TextWidget("<meta name=\"thing\"/>", mock)); MvelEvaluatorCompiler compiler = new MvelEvaluatorCompiler(Object.class); new HeaderWidget(widgetChain, Maps.<String, String>newHashMap(), compiler) .render(new Object(), respond); respond.writeToHead("<title>bs</title>"); final String response = respond.toString(); assert "<head><meta name=\"thing\"/><title>bs</title></head>".equals(response) : "instead printed: " + response; }