@Test public void testJsonWriter() { DataPipe dataFormatter = new DataPipe(); dataFormatter.getDataMap().put("var1", "var1val"); dataFormatter.getDataMap().put("var2", "var2val"); dataFormatter.getDataMap().put("var3", "var3val"); dataFormatter.getDataMap().put("var4", "var4val"); dataFormatter.getDataMap().put("var5", "var5val"); String[] outTemplate = new String[]{ "var1", "var2", "var3", "var4", "var5" }; JsonWriter jsonWriter = new JsonWriter(System.out, outTemplate); String expected = "{\"var5\":\"var5val\",\"var4\":\"var4val\",\"var3\":\"var3val\",\"var2\":\"var2val\"," + "\"var1\":\"var1val\"}"; Assert.assertEquals(5, dataFormatter.getDataMap().size()); Assert.assertEquals(expected, jsonWriter.getJsonFormatted(dataFormatter.getDataMap()).toString()); }
public JsonWriter(final OutputStream os, final String[] outTemplate) { this.os = os; this.outTemplate = outTemplate; this.jsonArray = new JSONArray(); }
JsonWriter implements BulkWriter { public JsonWriter(final OutputStream os, final String[] outTemplate) { this.os = os; this.outTemplate = outTemplate; this.jsonArray = new JSONArray(); } }
JsonWriter implements BulkWriter { public JsonWriter(final OutputStream os, final String[] outTemplate) { this.os = os; this.outTemplate = outTemplate; this.jsonArray = new JSONArray(); } JsonWriter(final OutputStream os, final String[] outTemplate); }
JsonWriter implements BulkWriter { public JsonWriter(final OutputStream os, final String[] outTemplate) { this.os = os; this.outTemplate = outTemplate; this.jsonArray = new JSONArray(); } JsonWriter(final OutputStream os, final String[] outTemplate); @Override void writeOutput(DataPipe cr); @Override void finish(); JSONObject getJsonFormatted(Map<String, String> dataMap); }
JsonWriter implements BulkWriter { public JsonWriter(final OutputStream os, final String[] outTemplate) { this.os = os; this.outTemplate = outTemplate; this.jsonArray = new JSONArray(); } JsonWriter(final OutputStream os, final String[] outTemplate); @Override void writeOutput(DataPipe cr); @Override void finish(); JSONObject getJsonFormatted(Map<String, String> dataMap);  }