### Question:
HamletImpl extends HamletSpec { public <T extends _> Generic<T> root(String name, EnumSet<EOpt> opts) { return new Generic<T>(name, null, opts); } HamletImpl(PrintWriter out, int nestLevel, boolean wasInline); int nestLevel(); boolean wasInline(); void setWasInline(boolean state); PrintWriter getWriter(); Generic<T> root(String name, EnumSet<EOpt> opts); Generic<T> root(String name); static String[] parseSelector(String selector); static E setSelector(E e, String selector); static E setLinkHref(E e, String href); static E setScriptSrc(E e, String src);  }### Answer:
@Test public void testGeneric() { PrintWriter out = spy(new PrintWriter(System.out)); HamletImpl hi = new HamletImpl(out, 0, false); hi. root("start")._attr("name", "value"). _("start text"). elem("sub")._attr("name", "value"). _("sub text")._(). elem("sub1")._noEndTag()._attr("boolean", null). _("sub1text")._(). _("start text2"). elem("pre")._pre(). _("pre text"). elem("i")._inline()._("inline")._()._(). elem("i")._inline()._("inline after pre")._(). _("start text3"). elem("sub2"). _("sub2text")._(). elem("sub3")._noEndTag(). _("sub3text")._(). elem("sub4")._noEndTag(). elem("i")._inline()._("inline")._(). _("sub4text")._()._(); out.flush(); assertEquals(0, hi.nestLevel); assertEquals(20, hi.indents); verify(out).print("<start"); verify(out, times(2)).print(" name=\"value\""); verify(out).print(" boolean"); verify(out).print("</start>"); verify(out, never()).print("</sub1>"); verify(out, never()).print("</sub3>"); verify(out, never()).print("</sub4>"); }