@Test void startingUpWithPassthroughThenDeduplicationTheStrategyShouldReturnAGoodResult() { BlobStoreConfigurationValidationStartUpCheck checkFirstStartUp = new BlobStoreConfigurationValidationStartUpCheck(PASSTHROUGH_STRATEGY, eventsourcingStorageStrategy); checkFirstStartUp.check(); BlobStoreConfigurationValidationStartUpCheck checkSecondStartUp = new BlobStoreConfigurationValidationStartUpCheck(DEDUPLICATION_STRATEGY, eventsourcingStorageStrategy); assertThat(checkSecondStartUp.check().getResultType()).isEqualTo(StartUpCheck.ResultType.GOOD); }
@Override public CheckResult check() { try { eventsourcingStorageStrategy.registerStorageStrategy(blobStoreConfiguration.storageStrategy()); return CheckResult.builder() .checkName(BLOB_STORE_CONFIGURATION_VALIDATION) .resultType(ResultType.GOOD) .build(); } catch (IllegalStateException e) { return CheckResult.builder() .checkName(BLOB_STORE_CONFIGURATION_VALIDATION) .resultType(ResultType.BAD) .description(e.getMessage()) .build(); } }
BlobStoreConfigurationValidationStartUpCheck implements StartUpCheck { @Override public CheckResult check() { try { eventsourcingStorageStrategy.registerStorageStrategy(blobStoreConfiguration.storageStrategy()); return CheckResult.builder() .checkName(BLOB_STORE_CONFIGURATION_VALIDATION) .resultType(ResultType.GOOD) .build(); } catch (IllegalStateException e) { return CheckResult.builder() .checkName(BLOB_STORE_CONFIGURATION_VALIDATION) .resultType(ResultType.BAD) .description(e.getMessage()) .build(); } } }
BlobStoreConfigurationValidationStartUpCheck implements StartUpCheck { @Override public CheckResult check() { try { eventsourcingStorageStrategy.registerStorageStrategy(blobStoreConfiguration.storageStrategy()); return CheckResult.builder() .checkName(BLOB_STORE_CONFIGURATION_VALIDATION) .resultType(ResultType.GOOD) .build(); } catch (IllegalStateException e) { return CheckResult.builder() .checkName(BLOB_STORE_CONFIGURATION_VALIDATION) .resultType(ResultType.BAD) .description(e.getMessage()) .build(); } } @VisibleForTesting @Inject  BlobStoreConfigurationValidationStartUpCheck(BlobStoreConfiguration blobStoreConfiguration, EventsourcingStorageStrategy eventsourcingStorageStrategy); }
BlobStoreConfigurationValidationStartUpCheck implements StartUpCheck { @Override public CheckResult check() { try { eventsourcingStorageStrategy.registerStorageStrategy(blobStoreConfiguration.storageStrategy()); return CheckResult.builder() .checkName(BLOB_STORE_CONFIGURATION_VALIDATION) .resultType(ResultType.GOOD) .build(); } catch (IllegalStateException e) { return CheckResult.builder() .checkName(BLOB_STORE_CONFIGURATION_VALIDATION) .resultType(ResultType.BAD) .description(e.getMessage()) .build(); } } @VisibleForTesting @Inject  BlobStoreConfigurationValidationStartUpCheck(BlobStoreConfiguration blobStoreConfiguration, EventsourcingStorageStrategy eventsourcingStorageStrategy); @Override CheckResult check(); @Override String checkName(); }
BlobStoreConfigurationValidationStartUpCheck implements StartUpCheck { @Override public CheckResult check() { try { eventsourcingStorageStrategy.registerStorageStrategy(blobStoreConfiguration.storageStrategy()); return CheckResult.builder() .checkName(BLOB_STORE_CONFIGURATION_VALIDATION) .resultType(ResultType.GOOD) .build(); } catch (IllegalStateException e) { return CheckResult.builder() .checkName(BLOB_STORE_CONFIGURATION_VALIDATION) .resultType(ResultType.BAD) .description(e.getMessage()) .build(); } } @VisibleForTesting @Inject  BlobStoreConfigurationValidationStartUpCheck(BlobStoreConfiguration blobStoreConfiguration, EventsourcingStorageStrategy eventsourcingStorageStrategy); @Override CheckResult check(); @Override String checkName();  }