T
- type of the value contained in the Predicate
.public class PredicateAssert<T> extends AbstractPredicateAssert<PredicateAssert<T>,T>
Predicate
.actual, info, myself, throwUnsupportedExceptionOnEquals
Modifier | Constructor and Description |
---|---|
protected |
PredicateAssert(Predicate<T> actual) |
Modifier and Type | Method and Description |
---|---|
PredicateAssert<T> |
accepts(T... values)
Verifies that the
Predicate evaluates all given values to true . |
PredicateAssert<T> |
rejects(T... values)
Verifies that the
Predicate evaluates all given values to false . |
acceptsAll, rejectsAll
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, withThreadDumpOnError
@SafeVarargs public final PredicateAssert<T> accepts(T... values)
AbstractPredicateAssert
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");
accepts
in class AbstractPredicateAssert<PredicateAssert<T>,T>
values
- values the actual Predicate
should accept.@SafeVarargs public final PredicateAssert<T> rejects(T... values)
AbstractPredicateAssert
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");
rejects
in class AbstractPredicateAssert<PredicateAssert<T>,T>
values
- values the actual Predicate
should reject.Copyright © 2014–2019 AssertJ. All rights reserved.