use of com.nexblocks.authguard.api.dto.validation.violations.Violation in project AuthGuard by AuthGuard.
the class PasswordResetRequestValidatorTest method validateValidByPasswordWithoutDomain.
@Test
void validateValidByPasswordWithoutDomain() {
final PasswordResetRequestDTO request = PasswordResetRequestDTO.builder().byToken(false).identifier("identifier").oldPassword("oldPassword").newPassword("newPassword").build();
final Validator<PasswordResetRequestDTO> validator = Validators.getForClass(PasswordResetRequestDTO.class);
final List<Violation> violations = validator.validate(request);
assertThat(violations).containsExactly(new Violation("domain", ViolationType.MISSING_REQUIRED_VALUE));
}
use of com.nexblocks.authguard.api.dto.validation.violations.Violation in project AuthGuard by AuthGuard.
the class PasswordlessRequestValidatorTest method validateValid.
@Test
void validateValid() {
final PasswordlessRequestDTO request = PasswordlessRequestDTO.builder().token("token").build();
final Validator<PasswordlessRequestDTO> validator = Validators.getForClass(PasswordlessRequestDTO.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 PasswordlessRequestValidatorTest method validateMissingFields.
@Test
void validateMissingFields() {
final PasswordlessRequestDTO request = PasswordlessRequestDTO.builder().build();
final Validator<PasswordlessRequestDTO> validator = Validators.getForClass(PasswordlessRequestDTO.class);
final List<Violation> violations = validator.validate(request);
assertThat(violations).contains(new Violation("token", ViolationType.MISSING_REQUIRED_VALUE));
}
use of com.nexblocks.authguard.api.dto.validation.violations.Violation in project AuthGuard by AuthGuard.
the class PermissionsRequestValidatorTest method validateNoFields.
@Test
void validateNoFields() {
final PermissionsRequestDTO request = PermissionsRequestDTO.builder().build();
final Validator<PermissionsRequestDTO> validator = Validators.getForClass(PermissionsRequestDTO.class);
final List<Violation> violations = validator.validate(request);
assertThat(violations).containsExactly(new Violation("permissions", ViolationType.EMPTY_LIST), new Violation("action", ViolationType.MISSING_REQUIRED_VALUE));
}
use of com.nexblocks.authguard.api.dto.validation.violations.Violation in project AuthGuard by AuthGuard.
the class RolesRequestValidatorTest method validateNoFields.
@Test
void validateNoFields() {
final RolesRequestDTO request = RolesRequestDTO.builder().build();
final Validator<RolesRequestDTO> validator = Validators.getForClass(RolesRequestDTO.class);
final List<Violation> violations = validator.validate(request);
assertThat(violations).containsExactly(new Violation("roles", ViolationType.EMPTY_LIST), new Violation("action", ViolationType.MISSING_REQUIRED_VALUE));
}
Aggregations