@Test public void testValidateConfig() { when(assetConfig.getAssetPath(AssetType.BIG_LOGO)).thenReturn(EXISTING_FILE_NAME); final ValidationResults validationResults = assetValidationService.validateConfig(assetConfig); assertThat(validationResults, is(valid())); }
@Override public ValidationResults validateConfig(final AssetConfig config) { final ValidationResults.Builder builder = new ValidationResults.Builder(); Arrays.stream(AssetType.values()) .collect(Collectors.toMap( Enum::name, type -> { final String assetPath = config.getAssetPath(type); if(assetPath == null) { return new ValidationResult<>(true); } final File asset = customizationService.getAsset(type, assetPath); return new ValidationResult<>(asset.exists()); })) .forEach(builder::put); return builder.build(); }
AssetValidationService implements ValidationService<AssetConfig> { @Override public ValidationResults validateConfig(final AssetConfig config) { final ValidationResults.Builder builder = new ValidationResults.Builder(); Arrays.stream(AssetType.values()) .collect(Collectors.toMap( Enum::name, type -> { final String assetPath = config.getAssetPath(type); if(assetPath == null) { return new ValidationResult<>(true); } final File asset = customizationService.getAsset(type, assetPath); return new ValidationResult<>(asset.exists()); })) .forEach(builder::put); return builder.build(); } }
AssetValidationService implements ValidationService<AssetConfig> { @Override public ValidationResults validateConfig(final AssetConfig config) { final ValidationResults.Builder builder = new ValidationResults.Builder(); Arrays.stream(AssetType.values()) .collect(Collectors.toMap( Enum::name, type -> { final String assetPath = config.getAssetPath(type); if(assetPath == null) { return new ValidationResult<>(true); } final File asset = customizationService.getAsset(type, assetPath); return new ValidationResult<>(asset.exists()); })) .forEach(builder::put); return builder.build(); } @Autowired  AssetValidationService(final CustomizationService customizationService); }
AssetValidationService implements ValidationService<AssetConfig> { @Override public ValidationResults validateConfig(final AssetConfig config) { final ValidationResults.Builder builder = new ValidationResults.Builder(); Arrays.stream(AssetType.values()) .collect(Collectors.toMap( Enum::name, type -> { final String assetPath = config.getAssetPath(type); if(assetPath == null) { return new ValidationResult<>(true); } final File asset = customizationService.getAsset(type, assetPath); return new ValidationResult<>(asset.exists()); })) .forEach(builder::put); return builder.build(); } @Autowired  AssetValidationService(final CustomizationService customizationService); @Override ValidationResults validateConfig(final AssetConfig config); @Override ValidationResults validateEnabledConfig(final AssetConfig config); @Override ValidationResult<?> validate(final OptionalConfigurationComponent<?> configurationComponent); }
AssetValidationService implements ValidationService<AssetConfig> { @Override public ValidationResults validateConfig(final AssetConfig config) { final ValidationResults.Builder builder = new ValidationResults.Builder(); Arrays.stream(AssetType.values()) .collect(Collectors.toMap( Enum::name, type -> { final String assetPath = config.getAssetPath(type); if(assetPath == null) { return new ValidationResult<>(true); } final File asset = customizationService.getAsset(type, assetPath); return new ValidationResult<>(asset.exists()); })) .forEach(builder::put); return builder.build(); } @Autowired  AssetValidationService(final CustomizationService customizationService); @Override ValidationResults validateConfig(final AssetConfig config); @Override ValidationResults validateEnabledConfig(final AssetConfig config); @Override ValidationResult<?> validate(final OptionalConfigurationComponent<?> configurationComponent);  }