@Test public void testValidate_failValidationCustomErrorMessage() { PasswordValidator underTest = new PasswordValidator("[a]+", "Bad bad bad"); thrown.expect(ValidationErrorsException.class); thrown.expectMessage("Bad bad bad"); underTest.validate("foo"); }
public void validate(final String password) { if (!passwordValidator.test(password)) { throw new ValidationErrorsException(errorMessage); } }
PasswordValidator { public void validate(final String password) { if (!passwordValidator.test(password)) { throw new ValidationErrorsException(errorMessage); } } }
PasswordValidator { public void validate(final String password) { if (!passwordValidator.test(password)) { throw new ValidationErrorsException(errorMessage); } } @Inject  PasswordValidator(
      @Nullable @Named("nexus.password.validator") final String passwordValidator,
      @Nullable @Named("nexus.password.validator.message") final String errorMessage); }
PasswordValidator { public void validate(final String password) { if (!passwordValidator.test(password)) { throw new ValidationErrorsException(errorMessage); } } @Inject  PasswordValidator(
      @Nullable @Named("nexus.password.validator") final String passwordValidator,
      @Nullable @Named("nexus.password.validator.message") final String errorMessage); void validate(final String password); }
PasswordValidator { public void validate(final String password) { if (!passwordValidator.test(password)) { throw new ValidationErrorsException(errorMessage); } } @Inject  PasswordValidator(
      @Nullable @Named("nexus.password.validator") final String passwordValidator,
      @Nullable @Named("nexus.password.validator.message") final String errorMessage); void validate(final String password);  }