@Test public void testGetXmlFormWithInvalidJsonShouldReturnEmptyString() { String xml = underTest.convert("content", "rootElementName"); assertEquals(xml, ""); }
@Override public String convert(final String json, final String rootName) { String xml; try { JSONObject jsonObject = new JSONObject(json); xml = buildXMLFrom(XML.toString(jsonObject), rootName); } catch (JSONException e) { logger.debug("Couldn't convert to XML the following JSON: " + json, e); xml = ""; } return xml; }
JsonConverter implements Converter { @Override public String convert(final String json, final String rootName) { String xml; try { JSONObject jsonObject = new JSONObject(json); xml = buildXMLFrom(XML.toString(jsonObject), rootName); } catch (JSONException e) { logger.debug("Couldn't convert to XML the following JSON: " + json, e); xml = ""; } return xml; } }
JsonConverter implements Converter { @Override public String convert(final String json, final String rootName) { String xml; try { JSONObject jsonObject = new JSONObject(json); xml = buildXMLFrom(XML.toString(jsonObject), rootName); } catch (JSONException e) { logger.debug("Couldn't convert to XML the following JSON: " + json, e); xml = ""; } return xml; }  }
JsonConverter implements Converter { @Override public String convert(final String json, final String rootName) { String xml; try { JSONObject jsonObject = new JSONObject(json); xml = buildXMLFrom(XML.toString(jsonObject), rootName); } catch (JSONException e) { logger.debug("Couldn't convert to XML the following JSON: " + json, e); xml = ""; } return xml; }  @Override String convert(final String json, final String rootName); }
JsonConverter implements Converter { @Override public String convert(final String json, final String rootName) { String xml; try { JSONObject jsonObject = new JSONObject(json); xml = buildXMLFrom(XML.toString(jsonObject), rootName); } catch (JSONException e) { logger.debug("Couldn't convert to XML the following JSON: " + json, e); xml = ""; } return xml; }  @Override String convert(final String json, final String rootName);  }