Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-19110

Cleanup CompletableFutureMatcher

    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • None
    • 3.0.0-beta2
    • None

    Description

      CompletableFutureMatcher was originally intended to match successful outcomes of a future. For checking that a future has failed, there exists a CompletableFutureExceptionMatcher. For some reason, though, CompletableFutureMatcher was extended to match exceptional outcomes as well, which makes the code ugly. Also, let's compare the diagnostic messages they provide:

      assertThat(failedFuture(new IllegalArgumentException()), CompletableFutureMatcher.willFailFast(NullPointerException.class))
      

      This matcher produces the following result:

      org.opentest4j.AssertionFailedError: 
      Expected :true
      Actual   :false
      
      assertThat(failedFuture(new IllegalArgumentException()), CompletableFutureExceptionMatcher.willThrow(NullPointerException.class));
      

      This matcher produces the following result:

      java.lang.AssertionError: 
      Expected: a future that completes with an exception that is an instance of java.lang.NullPointerException
           but: was completed exceptionally with <java.lang.IllegalArgumentException>
      Expected :a future that completes with an exception that is an instance of java.lang.NullPointerException
      Actual   :completed exceptionally with <java.lang.IllegalArgumentException>
      

      I propose to remove the exception checking part from CompletableFutureMatcher and replace it with CompletableFutureExceptionMatcher.

      Attachments

        Issue Links

          Activity

            People

              apolovtcev Aleksandr Polovtsev
              apolovtcev Aleksandr Polovtsev
              Kirill Tkalenko Kirill Tkalenko
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m