Package org.assertj.core.api
Class AbstractPredicateAssert<SELF extends AbstractPredicateAssert<SELF,T>,T>
java.lang.Object
org.assertj.core.api.AbstractAssert<SELF,Predicate<T>>
org.assertj.core.api.AbstractPredicateAssert<SELF,T>
- Type Parameters:
T- type of the value contained in thePredicate.
- All Implemented Interfaces:
Assert<SELF,,Predicate<T>> Descriptable<SELF>,ExtensionPoints<SELF,Predicate<T>>
- Direct Known Subclasses:
PredicateAssert
public abstract class AbstractPredicateAssert<SELF extends AbstractPredicateAssert<SELF,T>,T>
extends AbstractAssert<SELF,Predicate<T>>
Assertions for
Predicate.- Author:
- Filip Hrisafov
-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractPredicateAssert(Predicate<T> actual, Class<?> selfType) -
Method Summary
Modifier and TypeMethodDescriptionfinal SELFVerifies that thePredicateevaluates all given values totrue.acceptsAll(Iterable<? extends T> iterable) protected SELFacceptsForProxy(T[] values) final SELFVerifies that thePredicateevaluates all given values tofalse.rejectsAll(Iterable<? extends T> iterable) protected SELFrejectsForProxy(T[] values) Methods inherited from class org.assertj.core.api.AbstractAssert
actual, areEqual, asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, doesNotHaveToString, doesNotMatch, doesNotMatch, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, hasToString, inBinary, inHexadecimal, is, isElementOfCustomAssert, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, overridingErrorMessage, satisfies, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOfForProxy, satisfiesForProxy, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, usingEquals, usingEquals, usingRecursiveAssertion, usingRecursiveAssertion, usingRecursiveComparison, usingRecursiveComparison, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnErrorMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.assertj.core.api.Descriptable
as, as, as, describedAs, describedAs
-
Constructor Details
-
AbstractPredicateAssert
-
-
Method Details
-
accepts
Verifies that thePredicateevaluates all given values totrue.Example :
Predicate<String> ballSportPredicate = sport -> sport.contains("ball"); // assertion succeeds: assertThat(ballSportPredicate).accepts("football") .accepts("football", "basketball", "handball"); // assertions fail because of curling :p assertThat(ballSportPredicate).accepts("curling") assertThat(ballSportPredicate).accepts("football", "basketball", "curling");- Parameters:
values- values the actualPredicateshould accept.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualPredicatedoes not accept all the givenIterable's elements.
-
acceptsForProxy
-
rejects
Verifies that thePredicateevaluates all given values tofalse.Example :
Predicate<String> ballSportPredicate = sport -> sport.contains("ball"); // assertion succeeds: assertThat(ballSportPredicate).rejects("curling") .rejects("curling", "judo", "marathon"); // assertion fails because of football: assertThat(ballSportPredicate).rejects("football"); assertThat(ballSportPredicate).rejects("curling", "judo", "football");- Parameters:
values- values the actualPredicateshould reject.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualPredicateaccepts one of the givenIterable's elements.
-
rejectsForProxy
-
acceptsAll
Verifies that thePredicateevaluates all givenIterable's elements totrue.Example :
Predicate<String> ballSportPredicate = sport -> sport.contains("ball"); // assertion succeeds: assertThat(ballSportPredicate).acceptsAll(list("football", "basketball", "handball")); // assertion fails because of curling :p assertThat(ballSportPredicate).acceptsAll(list("football", "basketball", "curling"));- Parameters:
iterable-Iterablewhose elements the actualPredicateshould accept.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualPredicatedoes not accept all the givenIterable's elements.
-
rejectsAll
Verifies that thePredicateevaluates all givenIterable's elements tofalse.Example :
Predicate<String> ballSportPredicate = sport -> sport.contains("ball"); // assertion succeeds: assertThat(ballSportPredicate).rejectsAll(list("curling", "judo", "marathon")); // assertion fails because of football: assertThat(ballSportPredicate).rejectsAll(list("curling", "judo", "football"));- Parameters:
iterable-Iterablewhose elements the actualPredicateshould reject.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualPredicateaccepts one of the givenIterable's elements.
-