@Test public void shouldAcceptEmptyQueueURLAndLoginModeWhenConfigSourceIsFile() { StartupForm startupForm = new StartupForm(); startupForm.setAdminLogin(ADMIN_LOGIN); startupForm.setAdminPassword(ADMIN_PASSWORD); startupForm.setAdminConfirmPassword(ADMIN_CONFIRM_PASSWORD); startupForm.setAdminEmail(EMAIL); startupFormValidator = new StartupFormValidatorFactory().getStartupFormValidator(startupForm, userService); List<String> errors = startupFormValidator.validate(startupForm, ConfigSource.FILE); assertTrue(errors.isEmpty()); }
public List<String> validate(StartupForm target, ConfigSource configSource) { List<String> errors = new ArrayList<>(); for (AbstractValidator validator : validators) { validator.validate(target, errors, configSource); } return errors; }
StartupFormValidator { public List<String> validate(StartupForm target, ConfigSource configSource) { List<String> errors = new ArrayList<>(); for (AbstractValidator validator : validators) { validator.validate(target, errors, configSource); } return errors; } }
StartupFormValidator { public List<String> validate(StartupForm target, ConfigSource configSource) { List<String> errors = new ArrayList<>(); for (AbstractValidator validator : validators) { validator.validate(target, errors, configSource); } return errors; } StartupFormValidator(); }
StartupFormValidator { public List<String> validate(StartupForm target, ConfigSource configSource) { List<String> errors = new ArrayList<>(); for (AbstractValidator validator : validators) { validator.validate(target, errors, configSource); } return errors; } StartupFormValidator(); List<String> validate(StartupForm target, ConfigSource configSource); void add(AbstractValidator validator); List<AbstractValidator> getValidators(); }
StartupFormValidator { public List<String> validate(StartupForm target, ConfigSource configSource) { List<String> errors = new ArrayList<>(); for (AbstractValidator validator : validators) { validator.validate(target, errors, configSource); } return errors; } StartupFormValidator(); List<String> validate(StartupForm target, ConfigSource configSource); void add(AbstractValidator validator); List<AbstractValidator> getValidators();  }