Top Description Fields Constructors Methods
org.assertj.core.api

public abstract Class AbstractPredicateAssert<SELF extends AbstractPredicateAssert<SELF, T>, T>

extends AbstractAssert<SELF extends AbstractPredicateAssert<SELF, T>, Predicate<T>>
Class Inheritance
Known Direct Subclasses
org.assertj.core.api.PredicateAssert
Type Parameters
<T>
type of the value contained in the Predicate.
Static Imports
org.assertj.core.error.ShouldAccept.shouldAccept, .ShouldNotAccept.shouldNotAccept, org.assertj.core.util.Lists.list

Assertions for Predicate.
Author
Filip Hrisafov

Field Summary

Modifier and TypeField and Description
pack-priv Iterables
Inherited from org.assertj.core.api.AbstractAssert:
actualassertionErrorCreatorconditionscustomRepresentationinfomyselfobjectsprintAssertionsDescriptionthrowUnsupportedExceptionOnEquals

Constructor Summary

AccessConstructor and Description
protected
AbstractPredicateAssert(Predicate<T> actual, Class<?> selfType)

Method Summary

Modifier and TypeMethod and Description
public final SELF

Returns:

this assertion object.
accepts
(T...
values the actual Predicate should accept.
values
)

Verifies that the Predicate evaluates all given values to true.

public SELF

Returns:

this assertion object.
acceptsAll
(Iterable<? extends T>
Iterable whose elements the actual Predicate should accept.
iterable
)

Verifies that the Predicate evaluates all given Iterable's elements to true.

protected SELF
acceptsForProxy(T[] values)

public final SELF

Returns:

this assertion object.
rejects
(T...
values the actual Predicate should reject.
values
)

Verifies that the Predicate evaluates all given values to false.

public SELF

Returns:

this assertion object.
rejectsAll
(Iterable<? extends T>
Iterable whose elements the actual Predicate should reject.
iterable
)

Verifies that the Predicate evaluates all given Iterable's elements to false.

protected SELF
rejectsForProxy(T[] values)

Inherited from org.assertj.core.api.AbstractAssert:
areEqualasInstanceOfasListassertionErrorasStringdescribedAsdescriptionTextdoesNotHavedoesNotHaveSameClassAsdoesNotHaveSameHashCodeAsdoesNotHaveToStringdoesNotHaveToStringequalsextractingextractingfailurefailureWithActualExpectedfailWithActualExpectedAndMessagefailWithMessagegetWritableAssertionInfohashashCodehasSameClassAshasSameHashCodeAshasToStringhasToStringinBinaryinHexadecimalisisElementOfCustomAssertisEqualToisExactlyInstanceOfisInisInisInstanceOfisInstanceOfAnyisInstanceOfSatisfyingisNotisNotEqualToisNotExactlyInstanceOfisNotInisNotInisNotInstanceOfisNotInstanceOfAnyisNotNullisNotOfAnyClassInisNotSameAsisNullisOfAnyClassInisSameAsmatchesmatchesnewListAssertInstanceoverridingErrorMessageoverridingErrorMessagesatisfiessatisfiessatisfiessatisfiesAnyOfsatisfiesAnyOfsatisfiesAnyOfForProxysatisfiesForProxysetCustomRepresentationsetDescriptionConsumersetPrintAssertionsDescriptionthrowAssertionErrorusingComparatorusingComparatorusingDefaultComparatorusingRecursiveAssertionusingRecursiveAssertionusingRecursiveComparisonusingRecursiveComparisonwithAssertionStatewithFailMessagewithFailMessagewithRepresentationwithThreadDumpOnError

Field Detail

iterablesback to summary
pack-priv Iterables iterables
Annotations
@VisibleForTesting

Constructor Detail

AbstractPredicateAssertback to summary
protected AbstractPredicateAssert(Predicate<T> actual, Class<?> selfType)

Method Detail

acceptsback to summary
public final SELF accepts(T... values)

Verifies that the 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");
Parameters
values:T[]

values the actual Predicate should accept.

Returns:SELF

this assertion object.

Annotations
@SafeVarargs
Exceptions
AssertionError:
if the actual Predicate does not accept all the given Iterable's elements.
acceptsAllback to summary
public SELF acceptsAll(Iterable<? extends T> iterable)

Verifies that the 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"));
Parameters
iterable:Iterable<? extends T>

Iterable whose elements the actual Predicate should accept.

Returns:SELF

this assertion object.

Exceptions
AssertionError:
if the actual Predicate does not accept all the given Iterable's elements.
acceptsForProxyback to summary
protected SELF acceptsForProxy(T[] values)
rejectsback to summary
public final SELF rejects(T... values)

Verifies that the 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");
Parameters
values:T[]

values the actual Predicate should reject.

Returns:SELF

this assertion object.

Annotations
@SafeVarargs
Exceptions
AssertionError:
if the actual Predicate accepts one of the given Iterable's elements.
rejectsAllback to summary
public SELF rejectsAll(Iterable<? extends T> iterable)

Verifies that the 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"));
Parameters
iterable:Iterable<? extends T>

Iterable whose elements the actual Predicate should reject.

Returns:SELF

this assertion object.

Exceptions
AssertionError:
if the actual Predicate accepts one of the given Iterable's elements.
rejectsForProxyback to summary
protected SELF rejectsForProxy(T[] values)