Package org.apache.flink.core.testutils
Class FlinkAssertions
- java.lang.Object
-
- org.apache.flink.core.testutils.FlinkAssertions
-
public final class FlinkAssertions extends Object
Some reusable assertions and utilities for AssertJ.
-
-
Field Summary
Fields Modifier and Type Field Description static org.assertj.core.api.InstanceOfAssertFactory<Stream,org.assertj.core.api.ListAssert<Throwable>>STREAM_THROWABLE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.assertj.core.api.ThrowingConsumer<? super Throwable>anyCauseMatches(Class<? extends Throwable> clazz)static org.assertj.core.api.ThrowingConsumer<? super Throwable>anyCauseMatches(Class<? extends Throwable> clazz, String containsMessage)static org.assertj.core.api.ThrowingConsumer<? super Throwable>anyCauseMatches(String containsMessage)static org.assertj.core.api.ListAssert<Throwable>assertThatChainOfCauses(Throwable root)Shorthand to assert chain of causes.static <T> FlinkCompletableFutureAssert<T>assertThatFuture(CompletableFuture<T> actual)Create assertion forCompletableFuture.static <T> FlinkCompletableFutureAssert<T>assertThatFuture(CompletionStage<T> actual)Create assertion forCompletionStage.static Stream<Throwable>chainOfCauses(Throwable throwable)You can use this method in combination withAbstractAssert.extracting(Function, AssertFactory)to perform assertions on a chain of causes.
-
-
-
Field Detail
-
STREAM_THROWABLE
public static final org.assertj.core.api.InstanceOfAssertFactory<Stream,org.assertj.core.api.ListAssert<Throwable>> STREAM_THROWABLE
- See Also:
chainOfCauses(Throwable)
-
-
Method Detail
-
anyCauseMatches
public static org.assertj.core.api.ThrowingConsumer<? super Throwable> anyCauseMatches(Class<? extends Throwable> clazz, String containsMessage)
-
anyCauseMatches
public static org.assertj.core.api.ThrowingConsumer<? super Throwable> anyCauseMatches(Class<? extends Throwable> clazz)
-
anyCauseMatches
public static org.assertj.core.api.ThrowingConsumer<? super Throwable> anyCauseMatches(String containsMessage)
-
assertThatChainOfCauses
public static org.assertj.core.api.ListAssert<Throwable> assertThatChainOfCauses(Throwable root)
Shorthand to assert chain of causes. Same as:assertThat(throwable) .extracting(FlinkAssertions::chainOfCauses, FlinkAssertions.STREAM_THROWABLE)
-
chainOfCauses
public static Stream<Throwable> chainOfCauses(Throwable throwable)
You can use this method in combination withAbstractAssert.extracting(Function, AssertFactory)to perform assertions on a chain of causes. For example:assertThat(throwable) .extracting(FlinkAssertions::chainOfCauses, FlinkAssertions.STREAM_THROWABLE)- Returns:
- the list is ordered from the current
Throwableup to the root cause.
-
assertThatFuture
public static <T> FlinkCompletableFutureAssert<T> assertThatFuture(CompletableFuture<T> actual)
Create assertion forCompletableFuture.- Type Parameters:
T- the type of the value contained in theCompletableFuture.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThatFuture
public static <T> FlinkCompletableFutureAssert<T> assertThatFuture(CompletionStage<T> actual)
Create assertion forCompletionStage.- Type Parameters:
T- the type of the value contained in theCompletionStage.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
-