use of com.nexblocks.authguard.api.dto.validation.violations.Violation in project AuthGuard by AuthGuard.
the class CreateAccountRequestValidatorTest method validateInvalidEmail.
@Test
void validateInvalidEmail() {
final CreateAccountRequestDTO request = CreateAccountRequestDTO.builder().externalId("external").email(AccountEmailDTO.builder().email("invalid").build()).domain("main").build();
final Validator<CreateAccountRequestDTO> validator = Validators.getForClass(CreateAccountRequestDTO.class);
final List<Violation> violations = validator.validate(request);
assertThat(violations).contains(new Violation("email", ViolationType.INVALID_VALUE));
}
use of com.nexblocks.authguard.api.dto.validation.violations.Violation in project AuthGuard by AuthGuard.
the class CreateAccountRequestValidatorTest method validateNoDomain.
@Test
void validateNoDomain() {
final CreateAccountRequestDTO request = CreateAccountRequestDTO.builder().build();
final Validator<CreateAccountRequestDTO> validator = Validators.getForClass(CreateAccountRequestDTO.class);
final List<Violation> violations = validator.validate(request);
assertThat(violations).contains(new Violation("domain", ViolationType.MISSING_REQUIRED_VALUE));
}
use of com.nexblocks.authguard.api.dto.validation.violations.Violation in project AuthGuard by AuthGuard.
the class CreateAccountRequestValidatorTest method validateInvalidBackupEmail.
@Test
void validateInvalidBackupEmail() {
final CreateAccountRequestDTO request = CreateAccountRequestDTO.builder().externalId("external").backupEmail(AccountEmailDTO.builder().email("invalid").build()).domain("main").build();
final Validator<CreateAccountRequestDTO> validator = Validators.getForClass(CreateAccountRequestDTO.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 CreateAppRequestValidatorTest method validateValid.
@Test
void validateValid() {
final CreateAppRequestDTO request = CreateAppRequestDTO.builder().name("app").domain("main").build();
final Validator<CreateAppRequestDTO> validator = Validators.getForClass(CreateAppRequestDTO.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 CreateCredentialsRequestValidatorTest method validateMissingFields.
@Test
void validateMissingFields() {
final CreateCredentialsRequestDTO request = CreateCredentialsRequestDTO.builder().build();
final Validator<CreateCredentialsRequestDTO> validator = Validators.getForClass(CreateCredentialsRequestDTO.class);
final List<Violation> violations = validator.validate(request);
assertThat(violations).containsExactlyInAnyOrder(new Violation("accountId", ViolationType.MISSING_REQUIRED_VALUE), new Violation("plainPassword", ViolationType.MISSING_REQUIRED_VALUE), new Violation("identifiers", ViolationType.EMPTY_LIST), new Violation("domain", ViolationType.MISSING_REQUIRED_VALUE));
}
Aggregations