T - type of the value contained in the Predicate.public abstract class AbstractPredicateAssert<SELF extends AbstractPredicateAssert<SELF,T>,T> extends AbstractAssert<SELF,Predicate<T>>
Predicate.actual, info, myself, throwUnsupportedExceptionOnEquals| Modifier | Constructor and Description |
|---|---|
protected |
AbstractPredicateAssert(Predicate<T> actual,
Class<?> selfType) |
| Modifier and Type | Method and Description |
|---|---|
SELF |
accepts(T... values)
Verifies that the
Predicate evaluates all given values to true. |
SELF |
acceptsAll(Iterable<? extends T> iterable)
|
SELF |
rejects(T... values)
Verifies that the
Predicate evaluates all given values to false. |
SELF |
rejectsAll(Iterable<? extends T> iterable)
|
as, as, asList, asString, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, inBinary, inHexadecimal, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, setCustomRepresentation, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, withFailMessage, withRepresentation, withThreadDumpOnErrorpublic SELF accepts(T... values)
Predicate evaluates all given values to true.
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");values - values the actual Predicate should accept.AssertionError - if the actual Predicate does not accept all the given Iterable's elements.public SELF rejects(T... values)
Predicate evaluates all given values to false.
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");values - values the actual Predicate should reject.AssertionError - if the actual Predicate accepts one of the given Iterable's elements.public SELF acceptsAll(Iterable<? extends T> iterable)
Predicate evaluates all given Iterable's elements to true.
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"));iterable - Iterable whose elements the actual Predicate should accept.AssertionError - if the actual Predicate does not accept all the given Iterable's elements.public SELF rejectsAll(Iterable<? extends T> iterable)
Predicate evaluates all given Iterable's elements to false.
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"));iterable - Iterable whose elements the actual Predicate should reject.AssertionError - if the actual Predicate accepts one of the given Iterable's elements.Copyright © 2014–2019 AssertJ. All rights reserved.