### Question:
ResponseCodeMapper { public static ResponseCode getResponseCodeFromHttpCode(int httpResponseStatus, CougarFault fault) { if(httpResponseStatus == HttpServletResponse.SC_INTERNAL_SERVER_ERROR){ if(fault.getErrorCode().startsWith(COUGAR_FAULT_PREFIX)){ return ResponseCode.InternalError; } else{ return ResponseCode.BusinessException; } } for (Map.Entry<ResponseCode, Integer> entry : RESPONSE_CODES.entrySet()) { if (entry.getValue() == httpResponseStatus) { return entry.getKey(); } } return ResponseCode.InternalError; }  static void setResponseStatus(HttpServletResponse response, ResponseCode code); static int getHttpResponseCode(ResponseCode code); static ResponseCode getResponseCodeFromHttpCode(int httpResponseStatus, CougarFault fault);  }### Answer:
@Test public void testStandardMapping() { CougarFault fault = new Fault(FaultCode.Server, "DSC-0015"); ResponseCode responseCode = ResponseCodeMapper.getResponseCodeFromHttpCode(HttpServletResponse.SC_FORBIDDEN, fault); assertEquals(ResponseCode.Forbidden, responseCode); }
@Test public void testBusinessExceptionMapping() { CougarFault fault = new Fault(FaultCode.Server, "DSC-0001"); ResponseCode responseCode = ResponseCodeMapper.getResponseCodeFromHttpCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, fault); assertEquals(ResponseCode.InternalError, responseCode); fault = new Fault(FaultCode.Client, "Some Business Exception"); responseCode = ResponseCodeMapper.getResponseCodeFromHttpCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, fault); assertEquals(ResponseCode.BusinessException, responseCode); }
@Test public void testIdentityExceptionMappings() { CougarFault fault = new Fault(FaultCode.Client, "DSC-0033"); ResponseCode responseCode = ResponseCodeMapper.getResponseCodeFromHttpCode(HttpServletResponse.SC_BAD_REQUEST, fault); assertEquals(ResponseCode.BadRequest, responseCode); fault = new Fault(FaultCode.Client, "DSC-0034"); responseCode = ResponseCodeMapper.getResponseCodeFromHttpCode(HttpServletResponse.SC_BAD_REQUEST, fault); assertEquals(ResponseCode.BadRequest, responseCode); fault = new Fault(FaultCode.Client, "DSC-0035"); responseCode = ResponseCodeMapper.getResponseCodeFromHttpCode(HttpServletResponse.SC_BAD_REQUEST, fault); assertEquals(ResponseCode.BadRequest, responseCode); fault = new Fault(FaultCode.Client, "DSC-0036"); responseCode = ResponseCodeMapper.getResponseCodeFromHttpCode(HttpServletResponse.SC_BAD_REQUEST, fault); assertEquals(ResponseCode.BadRequest, responseCode); fault = new Fault(FaultCode.Client, "DSC-0037"); responseCode = ResponseCodeMapper.getResponseCodeFromHttpCode(HttpServletResponse.SC_FORBIDDEN, fault); assertEquals(ResponseCode.Forbidden, responseCode); fault = new Fault(FaultCode.Client, "DSC-0038"); responseCode = ResponseCodeMapper.getResponseCodeFromHttpCode(HttpServletResponse.SC_FORBIDDEN, fault); assertEquals(ResponseCode.Forbidden, responseCode); fault = new Fault(FaultCode.Client, "DSC-0039"); responseCode = ResponseCodeMapper.getResponseCodeFromHttpCode(HttpServletResponse.SC_BAD_REQUEST, fault); assertEquals(ResponseCode.BadRequest, responseCode); fault = new Fault(FaultCode.Client, "DSC-0040"); responseCode = ResponseCodeMapper.getResponseCodeFromHttpCode(HttpServletResponse.SC_FORBIDDEN, fault); assertEquals(ResponseCode.Forbidden, responseCode); }