response = _responseHandler.buildResponse(request,
buildRoutingResult(request, acceptTypeData.acceptHeaders),
ex);
checkResponse(response, 400, 3, acceptTypeData.responseContentType, ErrorResponse.class.getName(), null, true, true, errorResponseHeaderName);
DataMap dataMap = acceptTypeData.dataCodec.readMap(response.getEntity().asInputStream());
assertEquals(dataMap.getInteger("status"), Integer.valueOf(400));
assertEquals(dataMap.getString("message"), "missing fields");
// #2
ex = new RestLiServiceException(HttpStatus.S_400_BAD_REQUEST, "missing fields").setServiceErrorCode(11);
response = _responseHandler.buildResponse(request,
buildRoutingResult(request, acceptTypeData.acceptHeaders),
ex);
checkResponse(response, 400, 3, acceptTypeData.responseContentType, ErrorResponse.class.getName(), null, true, true, errorResponseHeaderName);
dataMap = acceptTypeData.dataCodec.readMap(response.getEntity().asInputStream());
assertEquals(dataMap.getInteger("status"), Integer.valueOf(400));
assertEquals(dataMap.getString("message"), "missing fields");
assertEquals(dataMap.getInteger("serviceErrorCode"), Integer.valueOf(11));
}