### Question:
HTTPErrorToCougarExceptionTransformer extends AbstractExceptionTransformer { public Exception convert(final InputStream inputStream, final ExceptionFactory exceptionFactory, final int httpStatusCode) { CougarFault fault = getFaultFromInputStream(inputStream); ResponseCode responseCode = ResponseCodeMapper.getResponseCodeFromHttpCode(httpStatusCode, fault); return exceptionFactory.parseException(responseCode, fault.getErrorCode(), fault.getFaultCode() + " fault received from remote server: "+ ServerFaultCode.getByDetailCode(fault.getErrorCode()), fault.getDetail().getFaultMessages()); } HTTPErrorToCougarExceptionTransformer(FaultUnMarshaller faultUnMarshaller); Exception convert(final InputStream inputStream, final ExceptionFactory exceptionFactory, final int httpStatusCode);  }### Answer:
@Test public void testTransform() throws UnsupportedEncodingException { FaultUnMarshaller faultUnMarshaller = mock(FaultUnMarshaller.class); ExceptionFactory exceptionFactory = mock(ExceptionFactory.class); CougarFault mockCougarFault = mock(CougarFault.class); FaultDetail df = mock(FaultDetail.class); when(mockCougarFault.getDetail()).thenReturn(df); when(df.getFaultMessages()).thenReturn(Collections.<String[]>emptyList()); when(faultUnMarshaller.unMarshallFault(any(InputStream.class), anyString())).thenReturn(mockCougarFault); when(exceptionFactory.parseException( any(ResponseCode.class), anyString(), anyString(), any(List.class))).thenReturn( new CougarClientException(ServerFaultCode.FrameworkError, "bang")); HTTPErrorToCougarExceptionTransformer tx = new HTTPErrorToCougarExceptionTransformer(faultUnMarshaller); Exception ex = tx.convert(new ByteArrayInputStream("hello".getBytes("UTF-8")), exceptionFactory, HttpServletResponse.SC_NOT_FOUND); assertNotNull(ex); }