JSONUtils { public static String getElasticSearchBulkHeader(SimpleDataEvent event, String index, String type) { StringBuilder builder = new StringBuilder(); builder.append("{\"index\":{\"_index\":\""); builder.append(index); builder.append("\",\"_type\":\""); builder.append(type); builder.append("\",\"_id\":\""); builder.append(event.getId()); builder.append("\"}}"); return builder.toString(); } private  JSONUtils(); static String getElasticSearchAddDocument(Map<String, String> values); static String getElasticSearchBulkHeader(SimpleDataEvent event, String index, String type);  }
@Test public void testGetElasticSearchBulkHeader() throws Exception { assertEquals("{\"index\":{\"_index\":\"test\",\"_type\":\"doc\",\"_id\":\"1\"}}", JSONUtils.getElasticSearchBulkHeader(new SimpleDataEvent("1"), "test", "doc")); }