### Question:
ParameterTableHandler implements ExtensionHandler { static ParameterTable parse(File file) throws IOException { LOG.debug("parsing JSON parameter table: {}", file); JsonFactory json = new JsonFactory(); json.disable(JsonParser.Feature.AUTO_CLOSE_SOURCE); json.enable(JsonParser.Feature.ALLOW_COMMENTS); json.enable(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES); json.enable(JsonParser.Feature.ALLOW_SINGLE_QUOTES); json.enable(JsonParser.Feature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER); json.enable(JsonParser.Feature.ALLOW_NUMERIC_LEADING_ZEROS); try (JsonParser parser = json.createParser(file)) { ParameterTable.Builder builder = IterativeExtensions.builder(); while (true) { JsonToken t = parser.nextToken(); if (t == null) { break; } else if (t == JsonToken.START_OBJECT) { builder.next(); parseRow(parser, builder); } else { throw new IOException(MessageFormat.format( "invalid JSON format (invalid start object): {0}", parser.getCurrentLocation())); } } return builder.build(); } }  @Override Extension handle(String tag, String value); static final String TAG; }### Answer:
@Test public void simple() throws Exception { File json = json(new String[] { "{}", }); ParameterTable table = ParameterTableHandler.parse(json); assertThat(table.getRowCount(), is(1)); List<ParameterSet> rows = table.getRows(); assertThat(rows.get(0).toMap(), is(map())); }
@Test public void columns() throws Exception { File json = json(new String[] { "{ a: 'A', b: 'B', c: 'C' }", }); ParameterTable table = ParameterTableHandler.parse(json); assertThat(table.getRowCount(), is(1)); List<ParameterSet> rows = table.getRows(); assertThat(rows.get(0).toMap(), is(map("a", "A", "b", "B", "c", "C"))); }
@Test public void rows() throws Exception { File json = json(new String[] { "{ a: 'A' }", "{ b: 'B' }", "{ c: 'C' }", }); ParameterTable table = ParameterTableHandler.parse(json); assertThat(table.getRowCount(), is(3)); List<ParameterSet> rows = table.getRows(); assertThat(rows.get(0).toMap(), is(map("a", "A"))); assertThat(rows.get(1).toMap(), is(map("b", "B"))); assertThat(rows.get(2).toMap(), is(map("c", "C"))); }