### Question:
GlobalHealthcheckHandler { protected HealthCheckSubsystem querySubsystemHealth(Endpoint subsystem) { HealthCheckStatus status = HealthCheckStatus.DOWN; URI uri = subsystem.getUri(); try { uri = UriBuilder.fromUri(subsystem.getUri()).path(actuatorContextPath).path(HEALTH).build(); logger.info("Calculated URL: {}", uri); ResponseEntity<SubsystemHealthcheckResponse> result = restTemplate.exchange(uri, HttpMethod.GET, buildHttpEntityForRequest(), SubsystemHealthcheckResponse.class); status = processResponseFromSubsystem(result, subsystem); } catch (Exception ex) { logger.error("Exception occured in GlobalHealthcheckHandler.querySubsystemHealth() ", ex); } return new HealthCheckSubsystem(subsystem.getSubsystem(), uri, status); }  @GET @Produces("application/json") @Operation(description = "Performing global health check", responses = @ApiResponse( content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional Response globalHealthcheck(@DefaultValue("true") @QueryParam("enableBpmn") boolean enableBpmn,
            @Context ContainerRequestContext requestContext);  }### Answer:
@Test public void testQuerySubsystemHealthNullResult() { ReflectionTestUtils.setField(globalhealth, "actuatorContextPath", "/manage"); Mockito.when(restTemplate.exchange(ArgumentMatchers.any(URI.class), ArgumentMatchers.any(HttpMethod.class), ArgumentMatchers.<HttpEntity<?>>any(), ArgumentMatchers.<Class<Object>>any())).thenReturn(null); HealthCheckSubsystem result = globalhealth .querySubsystemHealth(new Endpoint(SoSubsystems.BPMN, UriBuilder.fromPath("http: assertEquals(HealthCheckStatus.DOWN, result.getStatus()); }
@Test public void testQuerySubsystemHealthNotNullResult() { ReflectionTestUtils.setField(globalhealth, "actuatorContextPath", "/manage"); SubsystemHealthcheckResponse subSystemResponse = new SubsystemHealthcheckResponse(); subSystemResponse.setStatus("UP"); ResponseEntity<Object> r = new ResponseEntity<>(subSystemResponse, HttpStatus.OK); Mockito.when(restTemplate.exchange(ArgumentMatchers.any(URI.class), ArgumentMatchers.any(HttpMethod.class), ArgumentMatchers.<HttpEntity<?>>any(), ArgumentMatchers.<Class<Object>>any())).thenReturn(r); HealthCheckSubsystem result = globalhealth .querySubsystemHealth(new Endpoint(SoSubsystems.ASDC, UriBuilder.fromPath("http: assertEquals(HealthCheckStatus.UP, result.getStatus()); }