Class AssertionsForInterfaceTypes
For example:
int removed = employees.removeFired();
assertThat(removed).isZero();
List<Employee> newEmployees = employees.hired(TODAY);
assertThat(newEmployees).hasSize(6);
Java 8 is picky when choosing the right assertThat method if the object under test is generic and bounded,
for example if foo is instance of T that extends Exception, java 8 will complain that it can't resolve
the proper assertThat method (normally assertThat(Throwable) as foo might implement an interface like List,
if that occurred assertThat(List) would also be a possible choice - thus confusing java 8.
This why Assertions have been split in AssertionsForClassTypes and AssertionsForInterfaceTypes
(see http://stackoverflow.com/questions/29499847/ambiguous-method-in-java-8-why).
- Author:
- Alex Ruiz, Yvonne Wang, David DIDIER, Ted Young, Joel Costigliola, Matthieu Baechler, Mikhail Mazursky, Nicolas François, Julien Meddah, William Bakker, William Delanoue, Turbo87, dorzey
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <ACTUAL extends Iterable<? extends ELEMENT>,ELEMENT, ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT, ELEMENT>>
ClassBasedNavigableIterableAssert<?, ACTUAL, ELEMENT, ELEMENT_ASSERT> assertThat(ACTUAL actual, Class<ELEMENT_ASSERT> assertClass) Deprecated.static AbstractCharSequenceAssert<?, ? extends CharSequence> assertThat(CharSequence actual) Creates a new instance of.CharSequenceAssertstatic <ELEMENT> IterableAssert<ELEMENT> assertThat(Iterable<? extends ELEMENT> actual) Creates a new instance of.IterableAssertstatic <ACTUAL extends Iterable<? extends ELEMENT>,ELEMENT, ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT, ELEMENT>>
FactoryBasedNavigableIterableAssert<?, ACTUAL, ELEMENT, ELEMENT_ASSERT> assertThat(Iterable<? extends ELEMENT> actual, AssertFactory<ELEMENT, ELEMENT_ASSERT> assertFactory) Deprecated.This was added to help creating type-specific assertions for the elements of anIterableinstance.static AbstractPathAssert<?> assertThat(Path actual) Creates a new instance ofPathAssertstatic <E> AbstractCollectionAssert<?, Collection<? extends E>, E, ObjectAssert<E>> assertThat(Collection<? extends E> actual) Creates a new instance of.CollectionAssertstatic <RESULT> CompletableFutureAssert<RESULT> assertThat(CompletionStage<RESULT> actual) Create assertion forCompletionStageby converting it to aCompletableFutureand returning aCompletableFutureAssert.static DoublePredicateAssertassertThat(DoublePredicate actual) Create assertion forDoublePredicate.static IntPredicateAssertassertThat(IntPredicate actual) Create assertion forIntPredicate.static LongPredicateAssertassertThat(LongPredicate actual) Create assertion forLongPredicate.static <T> PredicateAssert<T> assertThat(Predicate<T> actual) Create assertion forPredicate.static <ELEMENT> IteratorAssert<ELEMENT> assertThat(Iterator<? extends ELEMENT> actual) Creates a new instance of.IteratorAssertstatic <ELEMENT> ListAssert<ELEMENT> assertThat(List<? extends ELEMENT> actual) Creates a new instance of.ListAssertstatic <ELEMENT,ACTUAL extends List<? extends ELEMENT>, ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT, ELEMENT>>
ClassBasedNavigableListAssert<?, ACTUAL, ELEMENT, ELEMENT_ASSERT> assertThat(List<? extends ELEMENT> actual, Class<ELEMENT_ASSERT> assertClass) Deprecated.This was added to help creating type-specific assertions for the elements of anListinstance.static <ACTUAL extends List<? extends ELEMENT>,ELEMENT, ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT, ELEMENT>>
FactoryBasedNavigableListAssert<?, ACTUAL, ELEMENT, ELEMENT_ASSERT> assertThat(List<? extends ELEMENT> actual, AssertFactory<ELEMENT, ELEMENT_ASSERT> assertFactory) Deprecated.This was added to help creating type-specific assertions for the elements of anIterableinstance.static <K,V> MapAssert <K, V> assertThat(Map<K, V> actual) Creates a new instance of.MapAssertstatic <ELEMENT> SpliteratorAssert<ELEMENT> assertThat(Spliterator<ELEMENT> actual) Create assertion forSpliteratorAssert.static ListAssert<Double> assertThat(DoubleStream actual) Creates a new instance offrom the givenListAssertDoubleStream.static ListAssert<Integer> assertThat(IntStream actual) Creates a new instance offrom the givenListAssertIntStream.static ListAssert<Long> assertThat(LongStream actual) Creates a new instance offrom the givenListAssertLongStream.static <ELEMENT> ListAssert<ELEMENT> assertThat(Stream<? extends ELEMENT> actual) Creates a new instance offrom the givenListAssertStream.static <T> TassertThat(AssertProvider<T> component) Delegates the creation of theAssertto theAssertProvider.assertThat()of the given component.static <T extends Comparable<? super T>>
AbstractComparableAssert<?, T> assertThat(T actual) Creates a new instance ofwith standard comparison semantics.GenericComparableAssertstatic <E> AbstractCollectionAssert<?, Collection<? extends E>, E, ObjectAssert<E>> assertThatCollection(Collection<? extends E> actual) Creates a new instance of.CollectionAssertstatic <T> AbstractUniversalComparableAssert<?, T> assertThatComparable(Comparable<T> actual) Creates a new instance ofwith standard comparison semantics.UniversalComparableAssertstatic <ELEMENT> IterableAssert<ELEMENT> assertThatIterable(Iterable<? extends ELEMENT> actual) Creates a new instance of.IterableAssertstatic <ELEMENT> IteratorAssert<ELEMENT> assertThatIterator(Iterator<? extends ELEMENT> actual) Creates a new instance of.IteratorAssertstatic <ELEMENT> ListAssert<ELEMENT> assertThatList(List<? extends ELEMENT> actual) Creates a new instance of.ListAssertstatic AbstractPathAssert<?> assertThatPath(Path actual) Creates a new instance ofPathAssertstatic <T> PredicateAssert<T> assertThatPredicate(Predicate<T> actual) Create assertion forPredicate.static <ELEMENT> ListAssert<ELEMENT> assertThatStream(Stream<? extends ELEMENT> actual) Creates a new instance offrom the givenListAssertStream.Methods inherited from class org.assertj.core.api.AssertionsForClassTypes
allOf, allOf, anyOf, anyOf, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThatCode, assertThatExceptionOfType, assertThatNoException, assertThatThrownBy, assertThatThrownBy, atIndex, catchThrowable, catchThrowableOfType, catchThrowableOfType, contentOf, contentOf, contentOf, contentOf, contentOf, contentOf, doesNotHave, entry, extractProperty, extractProperty, fail, fail, fail, fail, failBecauseExceptionWasNotThrown, filter, filter, in, linesOf, linesOf, linesOf, linesOf, linesOf, linesOf, linesOf, linesOf, linesOf, not, not, notIn, offset, offset, registerCustomDateFormat, registerCustomDateFormat, setAllowComparingPrivateFields, setAllowExtractingPrivateFields, setLenientDateParsing, setMaxLengthForSingleLineDescription, setRemoveAssertJRelatedElementsFromStackTrace, shouldHaveThrown, tuple, useDefaultDateFormatsOnly, within, within, within, within, within, within, within, withinPercentage, withinPercentage, withinPercentage
-
Constructor Details
-
AssertionsForInterfaceTypes
protected AssertionsForInterfaceTypes()Creates a new.Assertions
-
-
Method Details
-
assertThat
Delegates the creation of theAssertto theAssertProvider.assertThat()of the given component.Read the comments on
AssertProviderfor an example of its usage.- Type Parameters:
T- the AssertProvider wrapped type.- Parameters:
component- the component that creates its own assert- Returns:
- the associated
Assertof the given component
-
assertThat
Creates a new instance of.CharSequenceAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of.IterableAssert- Type Parameters:
ELEMENT- the type of elements.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThatIterable
public static <ELEMENT> IterableAssert<ELEMENT> assertThatIterable(Iterable<? extends ELEMENT> actual) Creates a new instance of.IterableAssertUse this over
assertThat(Iterable)in case of ambiguous method resolution when the object under test implements several interfaces Assertj providesassertThatfor.- Type Parameters:
ELEMENT- the type of elements.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.23.0
-
assertThat
Creates a new instance of.IteratorAssert- Type Parameters:
ELEMENT- the type of elements.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThatIterator
public static <ELEMENT> IteratorAssert<ELEMENT> assertThatIterator(Iterator<? extends ELEMENT> actual) Creates a new instance of.IteratorAssertUse this over
assertThat(Iterator)in case of ambiguous method resolution when the object under test implements several interfaces Assertj providesassertThatfor.- Type Parameters:
ELEMENT- the type of elements.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.23.0
-
assertThat
public static <E> AbstractCollectionAssert<?,Collection<? extends E>, assertThatE, ObjectAssert<E>> (Collection<? extends E> actual) Creates a new instance of.CollectionAssert- Type Parameters:
E- the type of elements.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.21.0
-
assertThatCollection
public static <E> AbstractCollectionAssert<?,Collection<? extends E>, assertThatCollectionE, ObjectAssert<E>> (Collection<? extends E> actual) Creates a new instance of.CollectionAssertUse this over
assertThat(Collection)in case of ambiguous method resolution when the object under test implements several interfaces Assertj providesassertThatfor.- Type Parameters:
E- the type of elements.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.23.0
-
assertThat
Creates a new instance of.ListAssert- Type Parameters:
ELEMENT- the type of elements.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThatList
Creates a new instance of.ListAssertUse this over
assertThat(List)in case of ambiguous method resolution when the object under test implements several interfaces Assertj providesassertThatfor.- Type Parameters:
ELEMENT- the type of elements.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.23.0
-
assertThat
Creates a new instance offrom the givenListAssertStream.Be aware that the
Streamunder test will be converted to aListwhen an assertions require to inspect its content. Once this is done theStreamcan't reused as it would have been consumed.Calling multiple methods on the returned
ListAssertis safe as it only interacts with theListbuilt from theStream.Examples:
// you can chain multiple assertions on the Stream as it is converted to a List assertThat(Stream.of(1, 2, 3)).contains(1) .doesNotContain(42);The following assertion fails as the Stream under test is converted to a List before being compared to the expected Stream:
// FAIL: the Stream under test is converted to a List and compared to a Stream but a List is not a Stream. assertThat(Stream.of(1, 2, 3)).isEqualTo(Stream.of(1, 2, 3));These assertions succeed as
isEqualToandisSameAschecks references which does not require to convert the Stream to a List.// The following assertions succeed as it only performs reference checking which does not require to convert the Stream to a List Stream<Integer> stream = Stream.of(1, 2, 3); assertThat(stream).isEqualTo(stream) .isSameAs(stream);- Type Parameters:
ELEMENT- the type of elements.- Parameters:
actual- the actualStreamvalue.- Returns:
- the created assertion object.
-
assertThatStream
Creates a new instance offrom the givenListAssertStream.Use this over
assertThat(Stream)in case of ambiguous method resolution when the object under test implements several interfaces Assertj providesassertThatfor.Be aware that the
Streamunder test will be converted to aListwhen an assertions require to inspect its content. Once this is done theStreamcan't reused as it would have been consumed.Calling multiple methods on the returned
ListAssertis safe as it only interacts with theListbuilt from theStream.Examples:
// you can chain multiple assertions on the Stream as it is converted to a List assertThat(Stream.of(1, 2, 3)).contains(1) .doesNotContain(42);The following assertion fails as the Stream under test is converted to a List before being compared to the expected Stream:
// FAIL: the Stream under test is converted to a List and compared to a Stream but a List is not a Stream. assertThat(Stream.of(1, 2, 3)).isEqualTo(Stream.of(1, 2, 3));These assertions succeed as
isEqualToandisSameAschecks references which does not require to convert the Stream to a List.// The following assertions succeed as it only performs reference checking which does not require to convert the Stream to a List Stream<Integer> stream = Stream.of(1, 2, 3); assertThat(stream).isEqualTo(stream) .isSameAs(stream);- Type Parameters:
ELEMENT- the type of elements.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.23.0
-
assertThat
Creates a new instance offrom the givenListAssertDoubleStream.Be aware that the
DoubleStreamunder test will be converted to aListwhen an assertions require to inspect its content. Once this is done theDoubleStreamcan't reused as it would have been consumed.Calling multiple methods on the returned
ListAssertis safe as it only interacts with theListbuilt from theDoubleStream.Examples:
// you can chain multiple assertions on the DoubleStream as it is converted to a List assertThat(DoubleStream.of(1.0, 2.0, 3.0)).contains(1.0) .doesNotContain(42.0);The following assertion fails as the DoubleStream under test is converted to a List before being compared to the expected DoubleStream:
// FAIL: the DoubleStream under test is converted to a List and compared to a DoubleStream but a List is not a DoubleStream. assertThat(DoubleStream.of(1.0, 2.0, 3.0)).isEqualTo(DoubleStream.of(1.0, 2.0, 3.0));These assertions succeed as
isEqualToandisSameAschecks references which does not require to convert the DoubleStream to a List.// The following assertions succeed as it only performs reference checking which does not require to convert the DoubleStream to a List DoubleStream stream = DoubleStream.of(1.0, 2.0, 3.0); assertThat(stream).isEqualTo(stream) .isSameAs(stream);- Parameters:
actual- the actualDoubleStreamvalue.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance offrom the givenListAssertLongStream.Be aware that the
LongStreamunder test will be converted to aListwhen an assertions require to inspect its content. Once this is done theLongStreamcan't reused as it would have been consumed.Calling multiple methods on the returned
ListAssertis safe as it only interacts with theListbuilt from theLongStream.Examples:
// you can chain multiple assertions on the LongStream as it is converted to a List assertThat(LongStream.of(1, 2, 3)).contains(1) .doesNotContain(42);The following assertion fails as the LongStream under test is converted to a List before being compared to the expected LongStream:
// FAIL: the LongStream under test is converted to a List and compared to a LongStream but a List is not a LongStream. assertThat(LongStream.of(1, 2, 3)).isEqualTo(LongStream.of(1, 2, 3));These assertions succeed as
isEqualToandisSameAschecks references which does not require to convert the LongStream to a List.// The following assertions succeed as it only performs reference checking which does not require to convert the LongStream to a List LongStream stream = LongStream.of(1, 2, 3); assertThat(stream).isEqualTo(stream) .isSameAs(stream);- Parameters:
actual- the actualLongStreamvalue.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance offrom the givenListAssertIntStream.Be aware that the
IntStreamunder test will be converted to aListwhen an assertions require to inspect its content. Once this is done theIntStreamcan't reused as it would have been consumed.Calling multiple methods on the returned
ListAssertis safe as it only interacts with theListbuilt from theIntStream.Examples:
// you can chain multiple assertions on the IntStream as it is converted to a List assertThat(IntStream.of(1, 2, 3)).contains(1) .doesNotContain(42);The following assertion fails as the IntStream under test is converted to a List before being compared to the expected IntStream:
// FAIL: the IntStream under test is converted to a List and compared to a IntStream but a List is not a IntStream. assertThat(IntStream.of(1, 2, 3)).isEqualTo(IntStream.of(1, 2, 3));These assertions succeed as
isEqualToandisSameAschecks references which does not require to convert the IntStream to a List.// The following assertions succeed as it only performs reference checking which does not require to convert the IntStream to a List IntStream stream = IntStream.of(1, 2, 3); assertThat(stream).isEqualTo(stream) .isSameAs(stream);- Parameters:
actual- the actualIntStreamvalue.- Returns:
- the created assertion object.
-
assertThat
@Deprecated public static <ACTUAL extends Iterable<? extends ELEMENT>,ELEMENT, FactoryBasedNavigableIterableAssert<?,ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT, ELEMENT>> ACTUAL, assertThatELEMENT, ELEMENT_ASSERT> (Iterable<? extends ELEMENT> actual, AssertFactory<ELEMENT, ELEMENT_ASSERT> assertFactory) Deprecated.This was added to help creating type-specific assertions for the elements of anIterableinstance.Deprecated way:
However, there is a better way withIterable<String> hobbits = Set.of("frodo", "sam", "Pippin"); assertThat(hobbits, StringAssert::new).first() .startsWith("fro") .endsWith("do");InstanceOfAssertFactoryand the correspondingfirst(InstanceOfAssertFactory).New way:
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.assertThat(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING .startsWith("fro") .endsWith("do");Creates a new instance of.IterableAssert- Type Parameters:
ACTUAL- The actual typeELEMENT- The actual elements typeELEMENT_ASSERT- The actual elements AbstractAssert type- Parameters:
actual- the actual value.assertFactory- the factory used to create the elements assert instance.- Returns:
- the created assertion object.
-
assertThat
@Deprecated public static <ACTUAL extends Iterable<? extends ELEMENT>,ELEMENT, ClassBasedNavigableIterableAssert<?,ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT, ELEMENT>> ACTUAL, assertThatELEMENT, ELEMENT_ASSERT> (ACTUAL actual, Class<ELEMENT_ASSERT> assertClass) Deprecated.This was added to help creating type-specific assertions for the elements of anIterableinstance.Deprecated way:
However, there is a better way withIterable<String> hobbits = Set.of("frodo", "sam", "Pippin"); assertThat(hobbits, StringAssert.class).first() .startsWith("fro") .endsWith("do");InstanceOfAssertFactoryand the correspondingfirst(InstanceOfAssertFactory).New way:
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.assertThat(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING .startsWith("fro") .endsWith("do"); -
assertThat
@Deprecated public static <ACTUAL extends List<? extends ELEMENT>,ELEMENT, FactoryBasedNavigableListAssert<?,ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT, ELEMENT>> ACTUAL, assertThatELEMENT, ELEMENT_ASSERT> (List<? extends ELEMENT> actual, AssertFactory<ELEMENT, ELEMENT_ASSERT> assertFactory) Deprecated.This was added to help creating type-specific assertions for the elements of anIterableinstance.Deprecated way:
However, there is a better way withList<String> hobbits = List.of("frodo", "sam", "Pippin"); assertThat(hobbits, StringAssert::new).first() .startsWith("fro") .endsWith("do");InstanceOfAssertFactoryand the correspondingfirst(InstanceOfAssertFactory).New way:
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.assertThat(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING .startsWith("fro") .endsWith("do"); -
assertThat
@Deprecated public static <ELEMENT,ACTUAL extends List<? extends ELEMENT>, ClassBasedNavigableListAssert<?,ELEMENT_ASSERT extends AbstractAssert<ELEMENT_ASSERT, ELEMENT>> ACTUAL, assertThatELEMENT, ELEMENT_ASSERT> (List<? extends ELEMENT> actual, Class<ELEMENT_ASSERT> assertClass) Deprecated.This was added to help creating type-specific assertions for the elements of anListinstance.Deprecated way:
However, there is a better way withList<String> hobbits = List.of("frodo", "sam", "Pippin"); assertThat(hobbits, StringAssert.class).first() .startsWith("fro") .endsWith("do");InstanceOfAssertFactoryand the correspondingfirst(InstanceOfAssertFactory).New way:
The main advantage of the latter is easier discoverability and the use of InstanceOfAssertFactory which is the preferred way to create type-specific assertions in AssertJ API.assertThat(hobbits).first(STRING) // static import of InstanceOfAssertFactories.STRING .startsWith("fro") .endsWith("do"); -
assertThat
Creates a new instance ofPathAssert- Parameters:
actual- the path to test- Returns:
- the created assertion object
-
assertThatPath
Creates a new instance ofPathAssertUse this over
assertThat(Path)in case of ambiguous method resolution when the object under test implements several interfaces Assertj providesassertThatfor.- Parameters:
actual- the path to test- Returns:
- the created assertion object
- Since:
- 3.23.0
-
assertThat
Creates a new instance of.MapAssertReturned type is
MapAssertas it overrides method to annotate them withSafeVarargsavoiding annoying warnings.- Type Parameters:
K- the type of keys in the map.V- the type of values in the map.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance ofwith standard comparison semantics.GenericComparableAssert- Type Parameters:
T- the type of actual.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThatComparable
Creates a new instance ofwith standard comparison semantics.UniversalComparableAssertUse this over
assertThat(Comparable)in case of ambiguous method resolution when the object under test implements several interfaces Assertj providesassertThatfor.- Type Parameters:
T- the type of actual.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.23.0
-
assertThat
Returns the given assertion. This method improves code readability by surrounding the given assertion withassertThat.Consider for example the following MyButton and MyButtonAssert classes:
As MyButtonAssert implements AssertDelegateTarget, you can usepublic class MyButton extends JButton { private boolean blinking; public boolean isBlinking() { return this.blinking; } public void setBlinking(boolean blink) { this.blinking = blink; } } private static class MyButtonAssert implements AssertDelegateTarget { private MyButton button; MyButtonAssert(MyButton button) { this.button = button; } void isBlinking() { // standard assertion from core Assertions.assertThat assertThat(button.isBlinking()).isTrue(); } void isNotBlinking() { // standard assertion from core Assertions.assertThat assertThat(button.isBlinking()).isFalse(); } }assertThat(buttonAssert).isBlinking();instead ofbuttonAssert.isBlinking();to have easier to read assertions:@Test public void AssertDelegateTarget_example() { MyButton button = new MyButton(); MyButtonAssert buttonAssert = new MyButtonAssert(button); // you can encapsulate MyButtonAssert assertions methods within assertThat assertThat(buttonAssert).isNotBlinking(); // same as : buttonAssert.isNotBlinking(); button.setBlinking(true); assertThat(buttonAssert).isBlinking(); // same as : buttonAssert.isBlinking(); }- Type Parameters:
T- the generic type of the user-defined assert.- Parameters:
assertion- the assertion to return.- Returns:
- the given assertion.
-
assertThat
Create assertion forPredicate.- Type Parameters:
T- the type of the value contained in thePredicate.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.5.0
-
assertThatPredicate
Create assertion forPredicate.Use this over
assertThat(Predicate)in case of ambiguous method resolution when the object under test implements several interfaces Assertj providesassertThatfor.- Type Parameters:
T- the type of the value contained in thePredicate.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.23.0
-
assertThat
Create assertion forIntPredicate.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.5.0
-
assertThat
Create assertion forLongPredicate.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.5.0
-
assertThat
Create assertion forDoublePredicate.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.5.0
-
assertThat
Create assertion forCompletionStageby converting it to aCompletableFutureand returning aCompletableFutureAssert.If the given
CompletionStageis null, theCompletableFuturein the returnedCompletableFutureAssertwill also be null.- Type Parameters:
RESULT- the type of the value contained in theCompletionStage.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
Create assertion forSpliteratorAssert.- Type Parameters:
ELEMENT- the type of elements- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
Iterableinstance.