Search in sources :

Example 1 with UpdateAccountRequestDTO

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

the class UpdateAccountRequestValidatorTest method validateValidBackupEmail.

@Test
void validateValidBackupEmail() {
    final UpdateAccountRequestDTO request = UpdateAccountRequestDTO.builder().backupEmail(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();
}
Also used : Violation(com.nexblocks.authguard.api.dto.validation.violations.Violation) UpdateAccountRequestDTO(com.nexblocks.authguard.api.dto.requests.UpdateAccountRequestDTO) Test(org.junit.jupiter.api.Test)

Example 2 with UpdateAccountRequestDTO

use of com.nexblocks.authguard.api.dto.requests.UpdateAccountRequestDTO 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();
}
Also used : Violation(com.nexblocks.authguard.api.dto.validation.violations.Violation) UpdateAccountRequestDTO(com.nexblocks.authguard.api.dto.requests.UpdateAccountRequestDTO) Test(org.junit.jupiter.api.Test)

Example 3 with UpdateAccountRequestDTO

use of com.nexblocks.authguard.api.dto.requests.UpdateAccountRequestDTO 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));
}
Also used : Violation(com.nexblocks.authguard.api.dto.validation.violations.Violation) UpdateAccountRequestDTO(com.nexblocks.authguard.api.dto.requests.UpdateAccountRequestDTO) Test(org.junit.jupiter.api.Test)

Example 4 with UpdateAccountRequestDTO

use of com.nexblocks.authguard.api.dto.requests.UpdateAccountRequestDTO 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();
}
Also used : Violation(com.nexblocks.authguard.api.dto.validation.violations.Violation) UpdateAccountRequestDTO(com.nexblocks.authguard.api.dto.requests.UpdateAccountRequestDTO) Test(org.junit.jupiter.api.Test)

Example 5 with UpdateAccountRequestDTO

use of com.nexblocks.authguard.api.dto.requests.UpdateAccountRequestDTO 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));
}
Also used : Violation(com.nexblocks.authguard.api.dto.validation.violations.Violation) UpdateAccountRequestDTO(com.nexblocks.authguard.api.dto.requests.UpdateAccountRequestDTO) Test(org.junit.jupiter.api.Test)

Aggregations

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