@Test public void formatTaxonResultSelectedFields() throws IOException { String result = "{\n" + " \"columns\" : [ \"taxon_common_names\", \"taxon_external_id\" ],\n" + " \"data\" : [ [ \"Isopoda\", \"123\"] ]\n" + "}"; ObjectMapper mapper = new ObjectMapper(); String format = new ResultFormatterJSONv2().format(result); JsonNode jsonNode = mapper.readTree(format); assertThat(jsonNode.isArray(), is(true)); JsonNode isopoda = jsonNode.get(0); assertThat(isopoda.get("taxon_common_names").asText(), is("Isopoda")); assertThat(isopoda.get("taxon_external_id").asText(), is("123")); }
@Override public String format(String result) throws ResultFormattingException { try { JsonNode jsonNode = RequestHelper.parse(result); return format(jsonNode); } catch (IOException e) { throw new ResultFormattingException("failed to format result", e); } }
ResultFormatterJSONv2 implements ResultFormatter { @Override public String format(String result) throws ResultFormattingException { try { JsonNode jsonNode = RequestHelper.parse(result); return format(jsonNode); } catch (IOException e) { throw new ResultFormattingException("failed to format result", e); } } }
ResultFormatterJSONv2 implements ResultFormatter { @Override public String format(String result) throws ResultFormattingException { try { JsonNode jsonNode = RequestHelper.parse(result); return format(jsonNode); } catch (IOException e) { throw new ResultFormattingException("failed to format result", e); } }  }
ResultFormatterJSONv2 implements ResultFormatter { @Override public String format(String result) throws ResultFormattingException { try { JsonNode jsonNode = RequestHelper.parse(result); return format(jsonNode); } catch (IOException e) { throw new ResultFormattingException("failed to format result", e); } }  @Override String format(String result); }
ResultFormatterJSONv2 implements ResultFormatter { @Override public String format(String result) throws ResultFormattingException { try { JsonNode jsonNode = RequestHelper.parse(result); return format(jsonNode); } catch (IOException e) { throw new ResultFormattingException("failed to format result", e); } }  @Override String format(String result);  }