use of com.nexblocks.authguard.api.dto.validation.violations.Violation in project AuthGuard by AuthGuard.
the class CreateAccountRequestValidatorTest method validateValidEmail.
@Test
void validateValidEmail() {
final CreateAccountRequestDTO request = CreateAccountRequestDTO.builder().externalId("external").email(AccountEmailDTO.builder().email("valid@valid.com").build()).domain("main").build();
final Validator<CreateAccountRequestDTO> validator = Validators.getForClass(CreateAccountRequestDTO.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 CreateAccountRequestValidatorTest method validateValidNoFields.
@Test
void validateValidNoFields() {
final CreateAccountRequestDTO request = CreateAccountRequestDTO.builder().domain("main").build();
final Validator<CreateAccountRequestDTO> validator = Validators.getForClass(CreateAccountRequestDTO.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 CreateAccountRequestValidatorTest method validateValidBackupEmail.
@Test
void validateValidBackupEmail() {
final CreateAccountRequestDTO request = CreateAccountRequestDTO.builder().externalId("external").backupEmail(AccountEmailDTO.builder().email("valid@valid.com").build()).domain("main").build();
final Validator<CreateAccountRequestDTO> validator = Validators.getForClass(CreateAccountRequestDTO.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 CreateAppRequestValidatorTest method validateMissingNameAndDomain.
@Test
void validateMissingNameAndDomain() {
final CreateAppRequestDTO request = CreateAppRequestDTO.builder().build();
final Validator<CreateAppRequestDTO> validator = Validators.getForClass(CreateAppRequestDTO.class);
final List<Violation> violations = validator.validate(request);
assertThat(violations).containsExactlyInAnyOrder(new Violation("name", ViolationType.MISSING_REQUIRED_VALUE), new Violation("domain", ViolationType.MISSING_REQUIRED_VALUE));
}
use of com.nexblocks.authguard.api.dto.validation.violations.Violation in project AuthGuard by AuthGuard.
the class CreateCredentialsRequestValidatorTest method validateInvalidIdentifierFields.
@Test
void validateInvalidIdentifierFields() {
final CreateCredentialsRequestDTO request = CreateCredentialsRequestDTO.builder().accountId("account").domain("main").addIdentifiers(UserIdentifierDTO.builder().build()).plainPassword("password").build();
final Validator<CreateCredentialsRequestDTO> validator = Validators.getForClass(CreateCredentialsRequestDTO.class);
final List<Violation> violations = validator.validate(request);
assertThat(violations).containsExactlyInAnyOrder(new Violation("type", ViolationType.MISSING_REQUIRED_VALUE), new Violation("identifier", ViolationType.MISSING_REQUIRED_VALUE));
}
Aggregations