CodeOutput extends CodeChunk implements CodeBlock { @Override public void print(String pattern, Object... args) { if (begin) { buffer.append(indent); begin = false; } if (args != null && args.length > 0) { buffer.append(String.format(pattern, args)); } else { buffer.append(pattern); } } CodeOutput(); protected  CodeOutput(Env env, String indent, StringBuilder buffer); String toDumpString(); @Override Writer getWriter(); @Override void indent(); @Override void dedent(); @Override void print(String pattern, Object... args); @Override void println(String pattern, Object... args); @Override CodeBlock block(); CodeOutput add(CodeRenderable renderable); @Override String gensym(); String toString(); @Override void append(CharSequence csq);  }
@Test public void testPrint() { CodeOutput output = new CodeOutput(); output.print("foo"); output.print("%d", 1); output.println("bar%d"); output.println("baz%d", 1); Assert.assertEquals(output.toString(), "foo1bar%d\nbaz1\n"); }