[ 
https://issues.apache.org/jira/browse/GEODE-5639?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16595700#comment-16595700
 ] 

ASF subversion and git services commented on GEODE-5639:
--------------------------------------------------------

Commit 281492aed8c290eff9bf83917439ded02bffef36 in geode's branch 
refs/heads/develop from [~apa...@the9muses.net]
[ https://gitbox.apache.org/repos/asf?p=geode.git;h=281492a ]

GEODE-5639: remove CatchException dependencies from Gradle


> Replace usage of CatchException with AssertJ and remove CatchException 
> dependency
> ---------------------------------------------------------------------------------
>
>                 Key: GEODE-5639
>                 URL: https://issues.apache.org/jira/browse/GEODE-5639
>             Project: Geode
>          Issue Type: Wish
>          Components: build, tests
>            Reporter: Kirk Lund
>            Assignee: Kirk Lund
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> We have a small number of tests using 
> com.googlecode.catchexception.CatchException. This project isn't very active 
> and AssertJ provides better support for testing expected exceptions and 
> throwables. Most Geode developers are already using AssertJ for expected 
> exceptions.
> The tests using CatchException should be updated to instead use AssertJ and 
> then remove our testing dependency on CatchException.
> The recommended ways of handling expected exception testing would then 
> involve using following AssertJ APIs:
> 1) Basic assertion about an expected exception
> Use: org.assertj.core.api.Assertions.assertThatThrownBy
> Example from JdbcWriterTest:
> {noformat}
>     assertThatThrownBy(() -> writer.beforeUpdate(entryEvent))
>         .isInstanceOf(IllegalArgumentException.class);
> {noformat}
> 2) Complex assertion about an expected exception (potentially with many 
> nested causes with messages that we want to validate as well)
> Use: org.assertj.core.api.Assertions.catchThrowable
> Example from DeltaPropagationFailureRegressionTest:
> {noformat}
>     Throwable thrown = server1.invoke(() -> catchThrowable(() -> 
> putDelta(FROM_DELTA)));
>     assertThat(thrown).isInstanceOf(DeltaSerializationException.class)
>         .hasMessageContaining("deserializing delta 
> bytes").hasCauseInstanceOf(EOFException.class);
> {noformat}
> 3) Simple assertion that an invocation should not thrown (probably used in a 
> regression test)
> Use: org.assertj.core.api.Assertions.assertThatCode
> Example from RegisterInterestDistributedTest:
> {noformat}
>     assertThatCode(() -> 
> clientCache.readyForEvents()).doesNotThrowAnyException();
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to