RestApiResponseHandler { public static Response getResponseInputJsonFormatError(InputJSONFormatErrorException e, Locale locale) { logger.error(e.getMessage()); String context = MessageUtil.getMessageString(e.getContext(), locale); String msg; if (e.getLine() > 0){ msg = MessageUtil.getMessageString(MessageUtil.RestResponseErrorMsg_input_json_format_location_error, locale, context, e.getLine(), e.getColumn()); } else { msg = MessageUtil.getMessageString(MessageUtil.RestResponseErrorMsg_input_json_format_error, locale, e.getMessage(), context); } return Response.status(Response.Status.BAD_REQUEST).entity(getErrorJsonString(msg)).build(); }  static Response getResponseOk(); static Response getResponseOk(String msg); static Response getResponseOk(JSONObject jsonObj); static Response getResponseCreatedOk(String msg); static Response getResponse200Ok(String msg); static Response getResponse204Ok(); static Response getResponseJsonOk(String jsonString); static Response getResponseJsonCreatedOk(String jsonString); static Response getResponseError(Exception e); static Response getResponseInternalServerError(String msg); static Response getResponseUnauthorized(String msg); static Response getResponseBadRequest(String msg); static Response getResponseNotFound(String msg); static Response getResponseJsonBuildError(Throwable t, Locale locale); static Response getResponseJsonParseError(Throwable t, Locale locale); static Response getResponseAppNotFound(AppNotFoundException e, Locale locale); static Response getResponseAppInfoNotFound(AppInfoNotFoundException e, Locale locale); static Response getResponseCloudError(CloudException e, Locale locale); static Response getResponseServiceNotFound(ServiceNotFoundException e, Locale locale); static Response getResponseInternalServerError(InternalServerErrorException e, Locale locale); static Response getResponseInputJsonParseError(InputJSONParseErrorException e, Locale locale); static Response getResponseInputJsonFormatError(InputJSONFormatErrorException e, Locale locale); static Response getResponseOutputJsonParseError(OutputJSONParseErrorException e, Locale locale); static Response getResponseOutputJsonFormatError(OutputJSONFormatErrorException e, Locale locale); static Response getResponseInternalAuthenticationFail(InternalAuthenticationException e, Locale locale); static Response getResponsePolicyNotExistError(PolicyNotFoundException e, Locale locale); static String getErrorJsonString(String errDesc); static String getErrorMessage(Exception e, Locale locale); static final String CLASS_NAME; static final Logger logger; }
@Test public void getResponseInputJsonFormatErrorTest() { assertEquals(RestApiResponseHandler.getResponseInputJsonFormatError(new InputJSONFormatErrorException(context, errorMessage, line, column), Locale.US).getEntity().toString(), "{\"error\" : \""+"CWSCV6012E: Format error at line 3 column 5 in the input JSON strings for API: Create/Update Policy."+"\"}"); }