[ 
https://issues.apache.org/jira/browse/IGNITE-19110?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kirill Tkalenko updated IGNITE-19110:
-------------------------------------
    Reviewer: Kirill Tkalenko

> Cleanup CompletableFutureMatcher
> --------------------------------
>
>                 Key: IGNITE-19110
>                 URL: https://issues.apache.org/jira/browse/IGNITE-19110
>             Project: Ignite
>          Issue Type: Task
>            Reporter: Aleksandr Polovtcev
>            Assignee: Aleksandr Polovtcev
>            Priority: Trivial
>              Labels: ignite-3
>             Fix For: 3.0.0-beta2
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> {{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:
> {code:java}
> assertThat(failedFuture(new IllegalArgumentException()), 
> CompletableFutureMatcher.willFailFast(NullPointerException.class))
> {code}
> This matcher produces the following result:
> {noformat}
> org.opentest4j.AssertionFailedError: 
> Expected :true
> Actual   :false
> {noformat}
> {code:java}
> assertThat(failedFuture(new IllegalArgumentException()), 
> CompletableFutureExceptionMatcher.willThrow(NullPointerException.class));
> {code}
> This matcher produces the following result:
> {noformat}
> 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>
> {noformat}
> I propose to remove the exception checking part from 
> {{CompletableFutureMatcher}} and replace it with 
> {{CompletableFutureExceptionMatcher}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to