@Test public void whenCleanupAttributeNotFoundReturnNull() { when(attributes.containsKey(CLEANUP_KEY)).thenReturn(false); assertThat(underTest.validate(configuration), is(nullValue())); verify(constraintFactory, times(0)).createViolation(anyString(), anyString()); }
@Nullable @Override public ConstraintViolation<?> validate(final Configuration configuration) { List<CleanupPolicy> cleanupPolicies = getCleanupPolicy(configuration); if (!cleanupPolicies.isEmpty()) { Optional<Format> format = getConfigurationFormat(configuration); if (format.isPresent()) { return validCleanupFormat(configuration.getRepositoryName(), format.get().getValue(), cleanupPolicies.get(0)); } } return null; }
CleanupConfigurationValidator implements ConfigurationValidator { @Nullable @Override public ConstraintViolation<?> validate(final Configuration configuration) { List<CleanupPolicy> cleanupPolicies = getCleanupPolicy(configuration); if (!cleanupPolicies.isEmpty()) { Optional<Format> format = getConfigurationFormat(configuration); if (format.isPresent()) { return validCleanupFormat(configuration.getRepositoryName(), format.get().getValue(), cleanupPolicies.get(0)); } } return null; } }
CleanupConfigurationValidator implements ConfigurationValidator { @Nullable @Override public ConstraintViolation<?> validate(final Configuration configuration) { List<CleanupPolicy> cleanupPolicies = getCleanupPolicy(configuration); if (!cleanupPolicies.isEmpty()) { Optional<Format> format = getConfigurationFormat(configuration); if (format.isPresent()) { return validCleanupFormat(configuration.getRepositoryName(), format.get().getValue(), cleanupPolicies.get(0)); } } return null; } @Inject  CleanupConfigurationValidator(final ConstraintViolationFactory constraintViolationFactory,
                                       final RepositoryManager repositoryManager,
                                       final CleanupPolicyStorage cleanupPolicyStorage); }
CleanupConfigurationValidator implements ConfigurationValidator { @Nullable @Override public ConstraintViolation<?> validate(final Configuration configuration) { List<CleanupPolicy> cleanupPolicies = getCleanupPolicy(configuration); if (!cleanupPolicies.isEmpty()) { Optional<Format> format = getConfigurationFormat(configuration); if (format.isPresent()) { return validCleanupFormat(configuration.getRepositoryName(), format.get().getValue(), cleanupPolicies.get(0)); } } return null; } @Inject  CleanupConfigurationValidator(final ConstraintViolationFactory constraintViolationFactory,
                                       final RepositoryManager repositoryManager,
                                       final CleanupPolicyStorage cleanupPolicyStorage); @Nullable @Override ConstraintViolation<?> validate(final Configuration configuration); }
CleanupConfigurationValidator implements ConfigurationValidator { @Nullable @Override public ConstraintViolation<?> validate(final Configuration configuration) { List<CleanupPolicy> cleanupPolicies = getCleanupPolicy(configuration); if (!cleanupPolicies.isEmpty()) { Optional<Format> format = getConfigurationFormat(configuration); if (format.isPresent()) { return validCleanupFormat(configuration.getRepositoryName(), format.get().getValue(), cleanupPolicies.get(0)); } } return null; } @Inject  CleanupConfigurationValidator(final ConstraintViolationFactory constraintViolationFactory,
                                       final RepositoryManager repositoryManager,
                                       final CleanupPolicyStorage cleanupPolicyStorage); @Nullable @Override ConstraintViolation<?> validate(final Configuration configuration);  }