JSONUtil { public String writeObjectAsString(Serializable obj) { try { return JsonUtilsV2.objToJson(obj); } catch (Exception e) { throw restErrorUtil.createRESTException( "Invalid input data: " + e.getMessage(), MessageEnums.INVALID_INPUT_DATA); } }  File writeJsonToFile(ViewBaseBean viewBean, String fileName); Map<String, String> jsonToMap(String jsonStr); String readMapToString(Map<?, ?> map); String readListToString(List<?> list); String writeObjectAsString(Serializable obj); T writeJsonToJavaObject(String json, Class<T> tClass);  }
@Test public void testWriteObjectAsString(){ String expectedJsonString = "{\"statusCode\":200,\"msgDesc\":\"Logout Successful\"}"; VXResponse vXResponse = new VXResponse(); vXResponse.setStatusCode(HttpServletResponse.SC_OK); vXResponse.setMsgDesc("Logout Successful"); String actualJsonString = jsonUtil.writeObjectAsString(vXResponse); Assert.assertEquals(expectedJsonString, actualJsonString); }