@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())); }
@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); } }
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); } } }
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); } }  }
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); }
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);  }