### Question:
GlobalHealthcheckHandler { @GET @Produces("application/json") @Operation(description = "Performing global health check", responses = @ApiResponse( content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response globalHealthcheck(@DefaultValue("true") @QueryParam("enableBpmn") boolean enableBpmn, @Context ContainerRequestContext requestContext) { Response HEALTH_CHECK_RESPONSE = null; HealthCheckResponse rsp = new HealthCheckResponse(); try { String requestId = requestContext.getProperty("requestId").toString(); logger.info(LoggingAnchor.TWO, MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId); List<Endpoint> endpoints = config.getEndpoints().stream().filter(item -> { if (!enableBpmn && SoSubsystems.BPMN.equals(item.getSubsystem())) { return false; } else { return true; } }).collect(Collectors.toList()); for (Endpoint endpoint : endpoints) { rsp.getSubsystems().add(querySubsystemHealth(endpoint)); } rsp.setMessage(String.format("HttpStatus: %s", HttpStatus.SC_OK)); logger.info(rsp.toString()); HEALTH_CHECK_RESPONSE = Response.status(HttpStatus.SC_OK).entity(rsp).build(); } catch (Exception ex) { logger.error("Exception occurred", ex); rsp.setMessage(ex.getMessage()); HEALTH_CHECK_RESPONSE = Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).entity(rsp).build(); } return HEALTH_CHECK_RESPONSE; }  @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 globalHealthcheckAllUPTest() throws JSONException, JsonProcessingException { HealthCheckResponse expected = new HealthCheckResponse(); for (Subsystem system : SoSubsystems.values()) { expected.getSubsystems().add(new HealthCheckSubsystem(system, UriBuilder.fromUri("http: } expected.setMessage("HttpStatus: 200"); Response response = globalHealthcheck("UP"); assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); HealthCheckResponse root; root = (HealthCheckResponse) response.getEntity(); assertThat(root, sameBeanAs(expected).ignoring("subsystems.uri").ignoring("subsystems.subsystem")); }
@Test public void globalHealthcheckAllDOWNTest() throws JSONException { HealthCheckResponse expected = new HealthCheckResponse(); for (Subsystem system : SoSubsystems.values()) { expected.getSubsystems().add(new HealthCheckSubsystem(system, UriBuilder.fromUri("http: } expected.setMessage("HttpStatus: 200"); Response response = globalHealthcheck("DOWN"); assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); HealthCheckResponse root; root = (HealthCheckResponse) response.getEntity(); assertThat(root, sameBeanAs(expected).ignoring("subsystems.uri").ignoring("subsystems.subsystem")); }