### Question:
CnfAdapterService { public ResponseEntity<InstanceResponse> getInstanceByInstanceId(String instanceId) throws JsonParseException, JsonMappingException, IOException { logger.info("CnfAdapterService createInstance called"); ResponseEntity<InstanceResponse> instanceResponse = null; try { String uri = "http: String path = "/v1/instance/" + instanceId; String endpoint = UriBuilder.fromUri(uri).path(path).build().toString(); HttpEntity<?> requestEntity = new HttpEntity<>(getHttpHeaders()); instanceResponse = restTemplate.exchange(endpoint, HttpMethod.GET, requestEntity, InstanceResponse.class); return instanceResponse; } catch (HttpClientErrorException e) { logger.error("Error Calling Multicloud, e"); if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) { throw new EntityNotFoundException(e.getResponseBodyAsString()); } throw e; } catch (HttpStatusCodeException e) { logger.error("Error in Multicloud, e"); String responseString = e.getResponseBodyAsString(); InstanceResponse result = new InstanceResponse(responseString.trim()); return ResponseEntity.status(e.getStatusCode()).body(result); } }  ResponseEntity<String> healthCheck(); ResponseEntity<InstanceResponse> createInstance(BpmnInstanceRequest bpmnInstanceRequest); ResponseEntity<InstanceResponse> getInstanceByInstanceId(String instanceId); ResponseEntity<InstanceStatusResponse> getInstanceStatusByInstanceId(String instanceId); ResponseEntity<InstanceMiniResponseList> getInstanceByRBNameOrRBVersionOrProfileName(String rbName,
            String rbVersion, String profileName); ResponseEntity<String> deleteInstanceByInstanceId(String instanceId);  }### Answer:
@Test public void getInstanceByInstanceIdTest() throws Exception { ResponseEntity<InstanceResponse> response = new ResponseEntity<InstanceResponse>(HttpStatus.OK); String instanceId = "123"; Mockito.when(restTemplate.exchange(Matchers.anyString(), Matchers.any(HttpMethod.class), Matchers.<HttpEntity<?>>any(), Matchers.<Class<InstanceResponse>>any())).thenReturn(response); ResponseEntity<InstanceResponse> actualResponse = cnfAdapterService.getInstanceByInstanceId(instanceId); Assert.assertNotNull(actualResponse); Assert.assertEquals(HttpStatus.OK, actualResponse.getStatusCode()); }