### Question:
JsonPrinter implements OutputPrinter { @Override public void finish() throws IOException { writer.flush(); } JsonPrinter(List<String> fieldNames, Writer writer); @Override void printRows(List<List<?>> rows, boolean complete); @Override void finish();  }### Answer:
@Test public void testJsonPrintingNoRows() throws Exception { StringWriter writer = new StringWriter(); List<String> fieldNames = ImmutableList.of("first", "last"); OutputPrinter printer = new JsonPrinter(fieldNames, writer); printer.finish(); assertEquals(writer.getBuffer().toString(), ""); }