XMLUtils { public static String getSolrAddDocument(Map<String, String> values) { StringBuilder builder = new StringBuilder(); builder.append("<add><doc>"); for (Map.Entry<String, String> pair : values.entrySet()) { XMLUtils.addSolrField(builder, pair); } builder.append("</doc></add>"); return builder.toString(); } private  XMLUtils(); static String getSolrAddDocument(Map<String, String> values);  }
@Test public void testGetSolrAddDocument() throws Exception { Map<String, String> pairs = new HashMap<String, String>(); pairs.put("aaa", "val_aaa"); pairs.put("bb", "val_bb"); assertEquals("<add><doc><field name=\"aaa\">val_aaa</field><field name=\"bb\">val_bb</field></doc></add>", XMLUtils.getSolrAddDocument(pairs)); }