use of com.nexblocks.authguard.api.dto.validation.violations.Violation in project AuthGuard by AuthGuard.
the class CreatePermissionRequestValidatorTest method validateValidRequest.
@Test
void validateValidRequest() {
final CreatePermissionRequestDTO request = CreatePermissionRequestDTO.builder().group("group").name("test-Permission").domain("main").build();
final Validator<CreatePermissionRequestDTO> validator = Validators.getForClass(CreatePermissionRequestDTO.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 CreateRoleRequestValidatorTest method validateNoNameOrDomain.
@Test
void validateNoNameOrDomain() {
final CreateRoleRequestDTO request = CreateRoleRequestDTO.builder().domain("main").build();
final Validator<CreateRoleRequestDTO> validator = Validators.getForClass(CreateRoleRequestDTO.class);
final List<Violation> violations = validator.validate(request);
assertThat(violations).containsExactly(new Violation("name", ViolationType.MISSING_REQUIRED_VALUE));
}
use of com.nexblocks.authguard.api.dto.validation.violations.Violation in project AuthGuard by AuthGuard.
the class PasswordResetRequestValidatorTest method validateValidByPassword.
@Test
void validateValidByPassword() {
final PasswordResetRequestDTO request = PasswordResetRequestDTO.builder().byToken(false).identifier("identifier").oldPassword("oldPassword").newPassword("newPassword").domain("main").build();
final Validator<PasswordResetRequestDTO> validator = Validators.getForClass(PasswordResetRequestDTO.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 PasswordResetRequestValidatorTest method validateMissingTokenAndNewPassword.
@Test
void validateMissingTokenAndNewPassword() {
final PasswordResetRequestDTO request = PasswordResetRequestDTO.builder().byToken(true).build();
final Validator<PasswordResetRequestDTO> validator = Validators.getForClass(PasswordResetRequestDTO.class);
final List<Violation> violations = validator.validate(request);
assertThat(violations).contains(new Violation("resetToken", ViolationType.MISSING_REQUIRED_VALUE));
assertThat(violations).contains(new Violation("newPassword", ViolationType.MISSING_REQUIRED_VALUE));
}
use of com.nexblocks.authguard.api.dto.validation.violations.Violation in project AuthGuard by AuthGuard.
the class PasswordResetRequestValidatorTest method validateValidByToken.
@Test
void validateValidByToken() {
final PasswordResetRequestDTO request = PasswordResetRequestDTO.builder().byToken(true).resetToken("token").newPassword("newPassword").build();
final Validator<PasswordResetRequestDTO> validator = Validators.getForClass(PasswordResetRequestDTO.class);
final List<Violation> violations = validator.validate(request);
assertThat(violations).isEmpty();
}
Aggregations