JsonHandler extends HandlerBase { protected JsonObjectBuilder showTextMDMetadata(TextMDMetadata textMD) { JsonObjectBuilder textmdBuilder = Json.createObjectBuilder(); String s = textMD.getCharset(); if (s != null) { textmdBuilder.add("textmd:charset", s); } if ((s = textMD.getByte_orderString()) != null) { textmdBuilder.add("textmd:byte_order", s); } if ((s = textMD.getByte_size()) != null) { textmdBuilder.add("textmd:byte_size", s); } if ((s = textMD.getCharacter_size()) != null) { textmdBuilder.add("textmd:character_size", s); } if ((s = textMD.getLinebreakString()) != null) { textmdBuilder.add("textmd:linebreak", s); } if ((s = textMD.getLanguage()) != null) { textmdBuilder.add("textmd:language", s); } if ((s = textMD.getMarkup_basis()) != null) { textmdBuilder.add("textmd:markup_basis", s); } if ((s = textMD.getMarkup_basis_version()) != null) { textmdBuilder.add("textmd:markup_basis_version", s); } if ((s = textMD.getMarkup_language()) != null) { textmdBuilder.add("textmd:markup_language", s); } if ((s = textMD.getMarkup_language_version()) != null) { textmdBuilder.add("textmd:markup_language_version", s); } return textmdBuilder; } 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 testShowTextMD() throws IOException { final TextMDMetadata textMD = new TextMDMetadata(); textMD.setCharset("UTF-8"); textMD.setLanguage("fr"); JsonObjectBuilder b = this.handler.showTextMDMetadata(textMD); buildJson(b); handler.close(); String result = outString.toString(); LOGGER.info(FIND + result); final String expected = "{\"textmd:charset\":\"UTF-8\",\"textmd:byte_order\":\"big\"," + "\"textmd:linebreak\":\"CR/LF\",\"textmd:language\":\"fre\"}"; assertEquals(expected, result); }