use of com.nexblocks.authguard.api.dto.validation.violations.Violation in project AuthGuard by AuthGuard.
the class CreateCredentialsRequestValidatorTest method validateValid.
@Test
void validateValid() {
final CreateCredentialsRequestDTO request = CreateCredentialsRequestDTO.builder().accountId("account").addIdentifiers(UserIdentifierDTO.builder().type(UserIdentifier.Type.USERNAME).identifier("username").build()).plainPassword("password").domain("main").build();
final Validator<CreateCredentialsRequestDTO> validator = Validators.getForClass(CreateCredentialsRequestDTO.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 CreatePermissionRequestValidatorTest method validateNoFields.
@Test
void validateNoFields() {
final CreatePermissionRequestDTO request = CreatePermissionRequestDTO.builder().build();
final Validator<CreatePermissionRequestDTO> validator = Validators.getForClass(CreatePermissionRequestDTO.class);
final List<Violation> violations = validator.validate(request);
assertThat(violations).containsExactlyInAnyOrder(new Violation("name", ViolationType.MISSING_REQUIRED_VALUE), new Violation("group", 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 CreateRoleRequestValidatorTest method validateValidRequest.
@Test
void validateValidRequest() {
final CreateRoleRequestDTO request = CreateRoleRequestDTO.builder().name("test-role").domain("main").build();
final Validator<CreateRoleRequestDTO> validator = Validators.getForClass(CreateRoleRequestDTO.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 OtpRequestValidatorTest method validateMissingFields.
@Test
void validateMissingFields() {
final OtpRequestDTO request = OtpRequestDTO.builder().build();
final Validator<OtpRequestDTO> validator = Validators.getForClass(OtpRequestDTO.class);
final List<Violation> violations = validator.validate(request);
assertThat(violations).containsExactlyInAnyOrder(new Violation("password", ViolationType.MISSING_REQUIRED_VALUE), new Violation("passwordId", ViolationType.MISSING_REQUIRED_VALUE));
}
use of com.nexblocks.authguard.api.dto.validation.violations.Violation in project AuthGuard by AuthGuard.
the class OtpRequestValidatorTest method validateValid.
@Test
void validateValid() {
final OtpRequestDTO request = OtpRequestDTO.builder().passwordId("password-id").password("password").build();
final Validator<OtpRequestDTO> validator = Validators.getForClass(OtpRequestDTO.class);
final List<Violation> violations = validator.validate(request);
assertThat(violations).isEmpty();
}
Aggregations