
com.github.jinahya.assertj.validation.ConstraintViolationAssert 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
* %%
* 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 org.assertj.core.api.AbstractClassAssert;
import org.assertj.core.api.AbstractObjectArrayAssert;
import org.assertj.core.api.Assert;
import org.assertj.core.api.AssertFactory;
import org.assertj.core.api.InstanceOfAssertFactories;
import org.assertj.core.api.ObjectArrayAssert;
import org.assertj.core.api.ObjectAssertFactory;
import javax.validation.ConstraintViolation;
import javax.validation.Path;
import javax.validation.metadata.ConstraintDescriptor;
import java.util.Objects;
import java.util.function.Function;
/**
* An assertion interface for verifying {@link ConstraintViolation} values.
*
* @param self type parameter
* @param actual type parameter
* @param root bean type parameter
*/
public interface ConstraintViolationAssert<
SELF extends ConstraintViolationAssert, ACTUAL extends ConstraintViolation, T>
extends Assert {
// -------------------------------------------------------------------------------------------- constraintDescriptor
, A extends AbstractConstraintDescriptorAssert, ? extends D, ?>>
A extractingConstraintDescriptor(
Function super ACTUAL, ? extends D> descriptorExtractor,
AssertFactory super D, ? extends A> assertFactory);
default ConstraintDescriptorAssert, ?, ?> extractingConstraintDescriptor() {
return extractingConstraintDescriptor(
ConstraintViolation::getConstraintDescriptor,
// do not change following line into a method reference!!!
(ConstraintDescriptor> cd) -> ValidationAssertions.assertThatConstraintDescriptor(cd)
);
}
// -------------------------------------------------------------------------------------------- executableParameters
, E> A extractingExecutableParameters(
final Function super ACTUAL, ? extends E[]> parametersExtractor,
final AssertFactory super E[], ? extends A> assertFactory);
default ObjectArrayAssert
© 2015 - 2025 Weber Informatics LLC | Privacy Policy