i am new to java and trying to write junit test cases for this. kindly help me out.
public static String getObjectString(Object obj)
{
String jsonRequestString = null;
ObjectMapper mapper = new ObjectMapper();
try{
jsonRequestString = mapper.writeValueAsString(obj);
}catch (Exception ex1) {
StringBuilder buff = new StringBuilder();
buff = new StringBuilder();
buff.append("\n***********************ERROR************************\n")
.append("JSONException OCCURED IN CommonUtil.getObjectString(Object obj): Error Details =>").append(ex1.getMessage())
.append("\n****************************************************\n");
log.error(buff.toString(),ex1);
}
return jsonRequestString;
Aucun commentaire:
Enregistrer un commentaire