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 Details

  • Method Details

    • anyCauseMatches

      public static org.assertj.core.api.ThrowingConsumer<? super Throwable> anyCauseMatches(Class<? extends Throwable> clazz, String containsMessage)
      Shorthand to assert the chain of causes includes a Throwable matching a specific Class and containing the provided message. Same as:
      
       assertThatChainOfCauses(throwable)
           .anySatisfy(
                cause ->
                    assertThat(cause)
                        .isInstanceOf(clazz)
                        .hasMessageContaining(containsMessage));
       
    • anyCauseMatches

      public static org.assertj.core.api.ThrowingConsumer<? super Throwable> anyCauseMatches(Class<? extends Throwable> clazz)
      Shorthand to assert the chain of causes includes a Throwable matching a specific Class. Same as:
      
       assertThatChainOfCauses(throwable)
           .anySatisfy(
                cause ->
                    assertThat(cause)
                        .isInstanceOf(clazz));
       
    • anyCauseMatches

      public static org.assertj.core.api.ThrowingConsumer<? super Throwable> anyCauseMatches(String containsMessage)
      Shorthand to assert the chain of causes includes a Throwable matching a specific Class and containing the provided message. Same as:
      
       assertThatChainOfCauses(throwable)
           .anySatisfy(
                cause ->
                    assertThat(cause)
                        .hasMessageContaining(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 with AbstractAssert.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 Throwable up to the root cause.
    • assertThatFuture

      public static <T> FlinkCompletableFutureAssert<T> assertThatFuture(CompletableFuture<T> actual)
      Create assertion for CompletableFuture.
      Type Parameters:
      T - the type of the value contained in the CompletableFuture.
      Parameters:
      actual - the actual value.
      Returns:
      the created assertion object.
    • assertThatFuture

      public static <T> FlinkCompletableFutureAssert<T> assertThatFuture(CompletionStage<T> actual)
      Create assertion for CompletionStage.
      Type Parameters:
      T - the type of the value contained in the CompletionStage.
      Parameters:
      actual - the actual value.
      Returns:
      the created assertion object.