### Question:
ApiCatalogHealthIndicator extends AbstractHealthIndicator { @Override protected void doHealthCheck(Health.Builder builder) { String gatewayServiceId = CoreService.GATEWAY.getServiceId(); boolean gatewayUp = !this.discoveryClient.getInstances(gatewayServiceId).isEmpty(); Status healthStatus = gatewayUp ? Status.UP : Status.DOWN; builder .status(healthStatus) .withDetail(gatewayServiceId, healthStatus.getCode()); }    }### Answer:
@Test public void testStatusIsUpWhenGatewayIsAvailable() { when(discoveryClient.getInstances(CoreService.GATEWAY.getServiceId())).thenReturn( Collections.singletonList( new DefaultServiceInstance(CoreService.GATEWAY.getServiceId(), "host", 10010, true))); apiCatalogHealthIndicator.doHealthCheck(builder); assertEquals(Status.UP, builder.build().getStatus()); }
@Test public void testStatusIsDownWhenGatewayIsNotAvailable() { when(discoveryClient.getInstances(CoreService.GATEWAY.getServiceId())).thenReturn(Collections.emptyList()); apiCatalogHealthIndicator.doHealthCheck(builder); assertEquals(Status.DOWN, builder.build().getStatus()); }