You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Ruan Hang (Jira)" <ji...@apache.org> on 2025/10/11 03:46:00 UTC
[jira] [Assigned] (FLINK-38488) Use 'throws Exception' instead of try-catch-fail in tests in flink-tests
[ https://issues.apache.org/jira/browse/FLINK-38488?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ruan Hang reassigned FLINK-38488:
---------------------------------
Assignee: Mingliang Liu
> 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
> Reporter: Mingliang Liu
> Assignee: Mingliang Liu
> Priority: Major
> Labels: pull-request-available
>
> Currently we have some tests using following patter:
> {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 handles 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 uses 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)