Search in sources :

Example 1 with BrutalValidator

use of org.mamute.controllers.BrutalValidator 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);
}
Also used : MessageFactory(org.mamute.factory.MessageFactory) MockValidator(br.com.caelum.vraptor.util.test.MockValidator) BrutalValidator(org.mamute.controllers.BrutalValidator) Before(org.junit.Before)

Example 2 with BrutalValidator

use of org.mamute.controllers.BrutalValidator 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);
}
Also used : UserDAO(org.mamute.dao.UserDAO) MessageFactory(org.mamute.factory.MessageFactory) MockValidator(br.com.caelum.vraptor.util.test.MockValidator) BundleFormatter(br.com.caelum.vraptor.simplemail.template.BundleFormatter) BrutalValidator(org.mamute.controllers.BrutalValidator) Before(org.junit.Before)

Aggregations

MockValidator (br.com.caelum.vraptor.util.test.MockValidator)2 Before (org.junit.Before)2 BrutalValidator (org.mamute.controllers.BrutalValidator)2 MessageFactory (org.mamute.factory.MessageFactory)2 BundleFormatter (br.com.caelum.vraptor.simplemail.template.BundleFormatter)1 UserDAO (org.mamute.dao.UserDAO)1