JSONUtil { public static String getJSONasDefaultPrettyPrint(Object obj) { ObjectMapper mapper = new ObjectMapper(); try { return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(obj); } catch (JsonProcessingException e) { return TVaultConstants.EMPTY_JSON; } }  static String getJSON(Object obj); static String getJSONasDefaultPrettyPrint(Object obj); static String getJSONasDefaultPrettyPrintFromString(String obj); static Object getObj(String jsonStr, Class<?> className);  }
@Test public void test_getJSONasDefaultPrettyPrint() throws Exception { String errorJsonStr="{}"; UserLogin userLogin = new UserLogin("testuser", "testuser"); String json = JSONUtil.getJSONasDefaultPrettyPrint(userLogin); assertNotEquals(errorJsonStr, json); }