Search in sources :

Example 1 with AccountEmailsRequestDTO

use of com.nexblocks.authguard.api.dto.requests.AccountEmailsRequestDTO in project AuthGuard by AuthGuard.

the class AccountEmailsRequestValidatorTest method validateInvalidEmail.

@Test
void validateInvalidEmail() {
    final AccountEmailsRequestDTO request = AccountEmailsRequestDTO.builder().email(AccountEmailDTO.builder().email("invalid").build()).build();
    final Validator<AccountEmailsRequestDTO> validator = Validators.getForClass(AccountEmailsRequestDTO.class);
    final List<Violation> violations = validator.validate(request);
    assertThat(violations).containsExactly(new Violation("email", ViolationType.INVALID_VALUE));
}
Also used : Violation(com.nexblocks.authguard.api.dto.validation.violations.Violation) AccountEmailsRequestDTO(com.nexblocks.authguard.api.dto.requests.AccountEmailsRequestDTO) Test(org.junit.jupiter.api.Test)

Example 2 with AccountEmailsRequestDTO

use of com.nexblocks.authguard.api.dto.requests.AccountEmailsRequestDTO in project AuthGuard by AuthGuard.

the class AccountEmailsRequestValidatorTest method validateValid.

@Test
void validateValid() {
    final AccountEmailsRequestDTO request = AccountEmailsRequestDTO.builder().email(AccountEmailDTO.builder().email("valid@valid.com").build()).build();
    final Validator<AccountEmailsRequestDTO> validator = Validators.getForClass(AccountEmailsRequestDTO.class);
    final List<Violation> violations = validator.validate(request);
    assertThat(violations).isEmpty();
}
Also used : Violation(com.nexblocks.authguard.api.dto.validation.violations.Violation) AccountEmailsRequestDTO(com.nexblocks.authguard.api.dto.requests.AccountEmailsRequestDTO) Test(org.junit.jupiter.api.Test)

Aggregations

AccountEmailsRequestDTO (com.nexblocks.authguard.api.dto.requests.AccountEmailsRequestDTO)2 Violation (com.nexblocks.authguard.api.dto.validation.violations.Violation)2 Test (org.junit.jupiter.api.Test)2