### Question:
HealthServiceImpl implements HealthService { @Override public HealthSummaryResponse isHealthy(final RequestContext ctx, TimeConstraints timeConstraints) throws HealthException { HealthSummaryResponse response = new HealthSummaryResponse(); if (isSystemInService()) { response.setHealthy(getHealth()); } else { response.setHealthy(RestrictedHealthStatus.FAIL); } return response; }  @Override void init(ContainerContext cc); @Override HealthSummaryResponse isHealthy(final RequestContext ctx, TimeConstraints timeConstraints); @Override HealthDetailResponse getDetailedHealthStatus(RequestContext reqCtx, TimeConstraints timeConstraints); @ManagedAttribute boolean isSystemInService(); @ManagedAttribute boolean isSystemHealthy();  }### Answer:
@Test public void isHealthy_Disabled() throws HealthException, IOException { when(containerContext.getRegisteredServices()).thenReturn(new ServiceInfo[] { new ServiceInfo(null, service, "HealthService", "3.0", new ArrayList<String>()) }); when(monitorRegistry.getStatusAggregator()).thenReturn(new DefaultStatusAggregator(Status.OK)); inOutServiceMonitor.setInService(false); HealthSummaryResponse response = service.isHealthy(requestContext, DefaultTimeConstraints.NO_CONSTRAINTS); response.validateMandatory(); assertEquals(RestrictedHealthStatus.FAIL, response.getHealthy()); }