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

Ruan Hang closed FLINK-38488.
-----------------------------
    Resolution: Fixed

master: 583ce7140c669ce6537d6ee76ed1ba331892aced

> Use 'throws Exception' instead of try-catch-fail in tests in flink-tests
> ------------------------------------------------------------------------
>
>                 Key: FLINK-38488
>                 URL: https://issues.apache.org/jira/browse/FLINK-38488
>             Project: Flink
>          Issue Type: Improvement
>          Components: Tests
>    Affects Versions: 2.2.0
>            Reporter: Mingliang Liu
>            Assignee: Mingliang Liu
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 2.2.0
>
>
> Currently we have some tests using following pattern:
> {code:java}
> try {
>   doTestSomething();
> } catch (Exception e) {
>   e.printStackTrace();
>   fail(e.getMessage());
> }{code}
> This can be replaced by just throwing Exceptions in test and let JUnit handle 
> the failure along with exception stack trace. The existing code loses stack 
> trace information in test reports, and we need to look around in the stdout 
> to guess.
> As we can see, other tests in Flink use the "throws Exception" model:
>   - The framework provides better formatting and integration with IDEs and CI 
> systems
>   - Test runners can distinguish between assertion failures and unexpected 
> exceptions
>  - Test logic is more readable without exception handling noise



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

Reply via email to