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,ProxyablePredicateAssert
public abstract class AbstractPredicateAssert<SELF extends AbstractPredicateAssert<SELF,T>,T> extends AbstractAssert<SELF,Predicate<T>>
Assertions forPredicate.- Author:
- Filip Hrisafov
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Iterablesiterables-
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, assertionErrorCreator, conditions, info, myself, objects, throwUnsupportedExceptionOnEquals
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractPredicateAssert(Predicate<T> actual, Class<?> selfType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SELFaccepts(T... values)Verifies that thePredicateevaluates all given values totrue.SELFacceptsAll(Iterable<? extends T> iterable)SELFrejects(T... values)Verifies that thePredicateevaluates all given values tofalse.SELFrejectsAll(Iterable<? extends T> iterable)-
Methods inherited from class org.assertj.core.api.AbstractAssert
as, as, asInstanceOf, 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, withAssertionState, withFailMessage, withRepresentation, withThreadDumpOnError
-
-
-
-
Field Detail
-
iterables
Iterables iterables
-
-
Method Detail
-
accepts
public SELF accepts(T... values)
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.
-
rejects
public SELF rejects(T... values)
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.
-
acceptsAll
public SELF acceptsAll(Iterable<? extends T> iterable)
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
public SELF rejectsAll(Iterable<? extends T> iterable)
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.
-
-