### Question:
CamundaClient { protected BPMNFailureException createBPMNFailureException(HttpStatusCodeException e) { ObjectMapper mapper = new ObjectMapper(); String responseText = null; String message = null; try { CamundaResponse response = mapper.readValue(e.getResponseBodyAsString(), CamundaResponse.class); responseText = response.getResponse(); } catch (IOException ex) { responseText = e.getResponseBodyAsString(); } message = String.valueOf(e.getStatusCode()); if (responseText != null && !responseText.isEmpty()) { message = message + " " + responseText; } BPMNFailureException bpmnException = new BPMNFailureException.Builder(message, responseHandler.setStatus(e.getStatusCode().value()), ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, e.getStatusCode()).build(); return bpmnException; }  ResponseEntity<String> post(String camundaReqXML, String requestId, String requestTimeout,
            String schemaVersion, String serviceInstanceId, String action, String orchestrationURI); ResponseEntity<String> post(RequestClientParameter parameterObject, String orchestrationURI); ResponseEntity<String> get(String url); ResponseEntity<String> post(String jsonReq, String url);  }### Answer:
@Test public void createBPMNFailureExceptionNoResponseBodyTest() { HttpServerErrorException e = new HttpServerErrorException(HttpStatus.NOT_FOUND); BPMNFailureException ex = client.createBPMNFailureException(e); assertEquals(HttpStatus.NOT_IMPLEMENTED.value(), ex.getHttpResponseCode()); assertEquals("Request Failed due to BPEL error with HTTP Status = 404 NOT_FOUND", ex.getMessage()); }
@Test public void createBPMNFailureExceptionWithCamundaResponseTest() throws IOException { HttpClientErrorException e = new HttpClientErrorException(HttpStatus.INTERNAL_SERVER_ERROR, null, inputStream("/CamundaFailure.json").getBytes(), null); BPMNFailureException ex = client.createBPMNFailureException(e); assertEquals(HttpStatus.BAD_GATEWAY.value(), ex.getHttpResponseCode()); assertEquals( "Request Failed due to BPEL error with HTTP Status = 500 INTERNAL_SERVER_ERROR <aetgt:WorkflowException xmlns:aetgt=\"http: ex.getMessage()); }
@Test public void createBPMNFailureExceptionTest() throws IOException { String response = "Request failed"; HttpClientErrorException e = new HttpClientErrorException(HttpStatus.INTERNAL_SERVER_ERROR, null, response.getBytes(), null); BPMNFailureException ex = client.createBPMNFailureException(e); assertEquals(HttpStatus.BAD_GATEWAY.value(), ex.getHttpResponseCode()); assertEquals("Request Failed due to BPEL error with HTTP Status = 500 INTERNAL_SERVER_ERROR Request failed", ex.getMessage()); }