Class FlinkAssertions


  • public final class FlinkAssertions
    extends Object
    Some reusable assertions and utilities for AssertJ.
    • Method Detail

      • 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.