JsonHandler extends HandlerBase { protected JsonObjectBuilder showAgent(Agent agent, String label) { JsonObjectBuilder agentBuilder = Json.createObjectBuilder(); agentBuilder.add("kind", label); agentBuilder.add("name", agent.getName()); agentBuilder.add("type", agent.getType().toString()); String s = agent.getAddress(); if (s != null) { agentBuilder.add("address", s); } if ((s = agent.getTelephone()) != null) { agentBuilder.add("telephone", s); } if ((s = agent.getFax()) != null) { agentBuilder.add("fax", s); } if ((s = agent.getEmail()) != null) { agentBuilder.add("email", s); } if ((s = agent.getWeb()) != null) { agentBuilder.add("web", s); } return agentBuilder; } JsonHandler();  JsonHandler(String name, String release, int[] date, String note, String rights); @Override void show(); @Override void show(App app); @Override void show(OutputHandler handler); @Override void show(Module module); @Override void show(RepInfo info); @Override void showFooter(); @Override void showHeader();  }
@Test public void testShowVendor() { OutputHandler jsonHandler = je.getHandler("JSON"); Agent v = jsonHandler.getVendor(); JsonObjectBuilder json = handler.showAgent(v, "OTHER"); buildJson(json); handler.close(); String result = outString.toString(); LOGGER.info(FIND + result); final String expected = "{\"kind\":\"OTHER\",\"name\":\"Bibliothèque nationale de France\"," + "\"type\":\"Educational\",\"web\":\"http: assertEquals(expected, result); }