@Test void testGetHealth() { prepareConfiguration(ImmutableHealthCheckConfiguration.builder() .mtaId(MTA_ID) .spaceId(SPACE_ID) .userName(USER_NAME) .timeRangeInSeconds(TIME_RANGE_IN_SECONDS) .build()); Health health = healthRetriever.getHealth(); assertTrue(health.isHealthy()); assertEquals(1, health.getHealthCheckOperations() .size()); HealthCheckOperation healthCheckOperation = health.getHealthCheckOperations() .get(0); validateHealthCheckOperationParameters(healthCheckOperation); Mockito.verify(operationQuery, times(1)) .user(USER_NAME); validateMandatoryParametersAreSet(); }
public Health getHealth() { HealthCheckConfiguration healthCheckConfiguration = configuration.getHealthCheckConfiguration(); ZonedDateTime currentTime = currentTimeSupplier.get(); ZonedDateTime xSecondsAgo = currentTime.minusSeconds(healthCheckConfiguration.getTimeRangeInSeconds()); List<Operation> healthCheckOperations = getHealthCheckOperations(healthCheckConfiguration, xSecondsAgo); return Health.fromOperations(healthCheckOperations); }
HealthRetriever { public Health getHealth() { HealthCheckConfiguration healthCheckConfiguration = configuration.getHealthCheckConfiguration(); ZonedDateTime currentTime = currentTimeSupplier.get(); ZonedDateTime xSecondsAgo = currentTime.minusSeconds(healthCheckConfiguration.getTimeRangeInSeconds()); List<Operation> healthCheckOperations = getHealthCheckOperations(healthCheckConfiguration, xSecondsAgo); return Health.fromOperations(healthCheckOperations); } }
HealthRetriever { public Health getHealth() { HealthCheckConfiguration healthCheckConfiguration = configuration.getHealthCheckConfiguration(); ZonedDateTime currentTime = currentTimeSupplier.get(); ZonedDateTime xSecondsAgo = currentTime.minusSeconds(healthCheckConfiguration.getTimeRangeInSeconds()); List<Operation> healthCheckOperations = getHealthCheckOperations(healthCheckConfiguration, xSecondsAgo); return Health.fromOperations(healthCheckOperations); } @Inject  HealthRetriever(OperationService operationService, ApplicationConfiguration configuration); protected  HealthRetriever(OperationService operationService, ApplicationConfiguration configuration,
                              Supplier<ZonedDateTime> currentTimeSupplier); }
HealthRetriever { public Health getHealth() { HealthCheckConfiguration healthCheckConfiguration = configuration.getHealthCheckConfiguration(); ZonedDateTime currentTime = currentTimeSupplier.get(); ZonedDateTime xSecondsAgo = currentTime.minusSeconds(healthCheckConfiguration.getTimeRangeInSeconds()); List<Operation> healthCheckOperations = getHealthCheckOperations(healthCheckConfiguration, xSecondsAgo); return Health.fromOperations(healthCheckOperations); } @Inject  HealthRetriever(OperationService operationService, ApplicationConfiguration configuration); protected  HealthRetriever(OperationService operationService, ApplicationConfiguration configuration,
                              Supplier<ZonedDateTime> currentTimeSupplier); Health getHealth(); }
HealthRetriever { public Health getHealth() { HealthCheckConfiguration healthCheckConfiguration = configuration.getHealthCheckConfiguration(); ZonedDateTime currentTime = currentTimeSupplier.get(); ZonedDateTime xSecondsAgo = currentTime.minusSeconds(healthCheckConfiguration.getTimeRangeInSeconds()); List<Operation> healthCheckOperations = getHealthCheckOperations(healthCheckConfiguration, xSecondsAgo); return Health.fromOperations(healthCheckOperations); } @Inject  HealthRetriever(OperationService operationService, ApplicationConfiguration configuration); protected  HealthRetriever(OperationService operationService, ApplicationConfiguration configuration,
                              Supplier<ZonedDateTime> currentTimeSupplier); Health getHealth();  }