
com.github.jinahya.assertj.validation.AbstractValidationAssert Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of assertj-bean-validation Show documentation
Show all versions of assertj-bean-validation Show documentation
An AssertJ extension for Bean-Validation
The newest version!
package com.github.jinahya.assertj.validation;
/*-
* #%L
* assertj-bean-validation-javax
* %%
* Copyright (C) 2021 - 2022 Jinahya, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import org.assertj.core.api.AbstractAssert;
import javax.validation.Validator;
import java.util.function.Supplier;
/**
* An abstract class for verifying a value against a specific property of a specific bean type.
*
* @param self type parameter
* @param actual type parameter
* @author Jin Kwon <onacit_at_gmail.com>
*/
abstract class AbstractValidationAssert, ACTUAL>
extends AbstractAssert
implements ValidationAssert {
/**
* Creates a new assertion object for verifying specified actual value.
*
* @param actual the value of {@link ACTUAL} to verify.
* @param selfType a class of {@link SELF}.
*/
protected AbstractValidationAssert(final ACTUAL actual, final Class> selfType) {
super(actual, selfType);
}
/**
* Configures this assertion object to use specified groups targeted for validation.
*
* @param groups the validation groups to use; {@code null} or empty for clearing the group.
* @return this assertion object.
*/
public final SELF targetingGroups(final Class>... groups) {
delegate.setGroups(groups);
return myself;
}
/**
* Configures this assertion object to use validators supplied by specified supplier.
*
* @param validatorSupplier the supplier supplying validators; {@code null} to reset.
* @return this assertion object.
*/
public final SELF usingValidatorSuppliedBy(final Supplier extends Validator> validatorSupplier) {
delegate.setValidatorSupplier(validatorSupplier);
return myself;
}
final ValidationAssertDelegate delegate = new ValidationAssertDelegate();
// ACTUAL actual() {
// return actual;
// }
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy