### Question:
JsonUtil { public static <T> String toJson(final T object) { try { return OBJECT_MAPPER.writeValueAsString(object); } catch (JsonProcessingException e) { e.printStackTrace(); } return "{}"; }  static ObjectMapper getObjectMapper(); static String toJson(final T object); static String toPrettyJson(final T object);  }### Answer:
@Test public void testUnableToJson() { final BadData badData = new BadData(); assertEquals("aaa", badData.getData()); assertEquals("{}", JsonUtil.toJson(badData)); }
@Test public void testToJson() { JsonUtil.toJson(null); JsonUtil.toJson(""); }