use of com.nexblocks.authguard.api.dto.validation.violations.Violation in project AuthGuard by AuthGuard.
the class UpdateAccountRequestValidatorTest method validateValidNoFields.
@Test
void validateValidNoFields() {
final UpdateAccountRequestDTO request = UpdateAccountRequestDTO.builder().build();
final Validator<UpdateAccountRequestDTO> validator = Validators.getForClass(UpdateAccountRequestDTO.class);
final List<Violation> violations = validator.validate(request);
assertThat(violations).isEmpty();
}
use of com.nexblocks.authguard.api.dto.validation.violations.Violation in project AuthGuard by AuthGuard.
the class UpdateAccountRequestValidatorTest method validateInvalidBackupEmail.
@Test
void validateInvalidBackupEmail() {
final UpdateAccountRequestDTO request = UpdateAccountRequestDTO.builder().backupEmail(AccountEmailDTO.builder().email("invalid").build()).build();
final Validator<UpdateAccountRequestDTO> validator = Validators.getForClass(UpdateAccountRequestDTO.class);
final List<Violation> violations = validator.validate(request);
assertThat(violations).contains(new Violation("backupEmail", ViolationType.INVALID_VALUE));
}
use of com.nexblocks.authguard.api.dto.validation.violations.Violation in project AuthGuard by AuthGuard.
the class UpdateAccountRequestValidatorTest method validateValidEmail.
@Test
void validateValidEmail() {
final UpdateAccountRequestDTO request = UpdateAccountRequestDTO.builder().email(AccountEmailDTO.builder().email("valid@valid.com").build()).build();
final Validator<UpdateAccountRequestDTO> validator = Validators.getForClass(UpdateAccountRequestDTO.class);
final List<Violation> violations = validator.validate(request);
assertThat(violations).isEmpty();
}
use of com.nexblocks.authguard.api.dto.validation.violations.Violation in project AuthGuard by AuthGuard.
the class UpdateAccountRequestValidatorTest method validateInvalidEmail.
@Test
void validateInvalidEmail() {
final UpdateAccountRequestDTO request = UpdateAccountRequestDTO.builder().email(AccountEmailDTO.builder().email("invalid").build()).build();
final Validator<UpdateAccountRequestDTO> validator = Validators.getForClass(UpdateAccountRequestDTO.class);
final List<Violation> violations = validator.validate(request);
assertThat(violations).contains(new Violation("email", ViolationType.INVALID_VALUE));
}
Aggregations