use of br.com.caelum.vraptor.util.test.MockValidator in project mamute by caelum.
the class EmailValidatorTest method setup.
@Before
public void setup() {
users = mock(UserDAO.class);
messageFactory = mock(MessageFactory.class);
validator = new MockValidator();
emailValidator = new EmailValidator(validator, users, messageFactory);
existant = "existant@brutal.com";
unexistant = "unexistant@brutal.com";
when(users.existsWithEmail(existant)).thenReturn(true);
when(users.existsWithEmail(unexistant)).thenReturn(false);
when(users.existsWithEmail(null)).thenReturn(false);
}
use of br.com.caelum.vraptor.util.test.MockValidator in project mamute by caelum.
the class TagsValidatorTest method setup.
@Before
public void setup() {
environment = mock(Environment.class);
when(environment.get("tags.sanitizer.regex")).thenReturn("[a-zA-Z0-9-]");
messageFactory = new MessageFactory(bundle);
validator = new MockValidator();
tagsValidator = new TagsValidator(environment, validator, messageFactory);
User user = user("any", "any@brutal.com");
java = new Tag("java", "", user);
ruby = new Tag("ruby", "", user);
rails = new Tag("rails", "", user);
nonalpha = new Tag("java,mysql", "", user);
}
use of br.com.caelum.vraptor.util.test.MockValidator in project mamute by caelum.
the class SignupValidatorTest method setup.
@Before
public void setup() {
validator = new MockValidator();
messageFactory = new MessageFactory(bundle);
emailValidator = new EmailValidator(validator, users, messageFactory);
javax.validation.Validator javaxValidator = Validation.buildDefaultValidatorFactory().getValidator();
BrutalValidator brutalValidator = new BrutalValidator(javaxValidator, validator, messageFactory);
userValidator = new UserValidator(validator, emailValidator, messageFactory, brutalValidator);
signupValidator = new SignupValidator(validator, userValidator, messageFactory, users);
when(users.existsWithEmail(VALID_EMAIL)).thenReturn(false);
when(users.existsWithName(VALID_USER_NAME)).thenReturn(false);
}
use of br.com.caelum.vraptor.util.test.MockValidator in project mamute by caelum.
the class UserPersonalInfoValidatorTest method setup.
@Before
public void setup() {
this.bundle = mock(BundleFormatter.class);
this.validEmail = "artur.adam@email.com.br";
this.users = mock(UserDAO.class);
this.validator = new MockValidator();
this.messageFactory = new MessageFactory(mock(ResourceBundle.class));
this.emailValidator = new EmailValidator(validator, users, messageFactory);
javax.validation.Validator javaxValidator = Validation.buildDefaultValidatorFactory().getValidator();
BrutalValidator brutalValidator = new BrutalValidator(javaxValidator, validator, messageFactory);
this.infoValidator = new UserPersonalInfoValidator(validator, emailValidator, messageFactory, bundle, brutalValidator);
}
Aggregations