### Question:
ResultFormatterSVG implements ResultFormatter { @Override public String format(final String content) throws ResultFormattingException { JsonNode results; try { results = RequestHelper.parse(content); } catch (IOException e) { throw new ResultFormattingException("failed to parse", e); } JsonNode rows = results.get("data"); String badge = rows != null && rows.size() > 0 ? "known.svg" : "unknown.svg"; try { return IOUtils.toString(getClass().getResourceAsStream(badge), StandardCharsets.UTF_8); } catch (IOException e) { throw new ResultFormattingException("failed to render badge", e); } }  @Override String format(final String content);  }### Answer:
@Test public void formatter() throws ResultFormattingException { String svg = new ResultFormatterSVG().format("{\n" + " \"columns\" : [ \"source_taxon_name\", \"interaction_type\", \"target_taxon_name\" ],\n" + " \"data\" : [ [ \"Vireo olivaceus\", \"preysOn\", [ \"Diptera\", \"Auchenorrhyncha\", \"Coleoptera\", \"Lepidoptera\", \"Arachnida\" ] ], [ \"Colaptes auratus\", \"preysOn\", [ \"Hymenoptera\" ] ], [ \"Anseriformes\", \"preysOn\", [ \"Cyperaceae\", \"Tracheophyta\", \"marine invertebrates\" ] ], [ \"Geositta\", \"preysOn\", [ \"Insecta\", \"Coelopidae\", \"Diptera\", \"Talitridae\" ] ], [ \"Patagioenas squamosa\", \"preysOn\", [ \"fruit\" ] ], [ \"Ardea cinerea\", \"preysOn\", [ \"Anguilla anguilla\", \"Pollachius virens\", \"Ammodytes tobianus\", \"Zoarces viviparus\", \"Pholis gunnellus\", \"Myoxocephalus scorpius\", \"Pomatoschistus microps\", \"Crangon crangon\", \"Salmo trutta\" ] ], [ \"Setophaga petechia\", \"preysOn\", [ \"Araneae\", \"Insecta\", \"Orthoptera\", \"fruit and seeds\", \"Hemiptera\", \"Diptera\", \"Lepidoptera\", \"Formicidae\", \"Hymenoptera\", \"Coleoptera\", \"Auchenorrhyncha\" ] ] ] }"); assertThat(svg, is(notNullValue())); }
@Test public void formatterNotSourceTaxon() throws ResultFormattingException { String svg = new ResultFormatterSVG().format("{\n" + " \"columns\" : [ \"source_taxon_namez\", \"interaction_type\", \"target_taxon_namez\" ]\n" + " }"); assertThat(svg, is(notNullValue())); }