You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Yang Jie (Jira)" <ji...@apache.org> on 2023/07/06 14:18:00 UTC

[jira] [Assigned] (SPARK-44314) Add a new checkstyle rule to prohibit the use of `@Test(expected = SomeException.class)`

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

Yang Jie reassigned SPARK-44314:
--------------------------------

    Assignee: Yang Jie

> Add a new checkstyle rule to prohibit the use of `@Test(expected = SomeException.class)`
> ----------------------------------------------------------------------------------------
>
>                 Key: SPARK-44314
>                 URL: https://issues.apache.org/jira/browse/SPARK-44314
>             Project: Spark
>          Issue Type: Improvement
>          Components: Build
>    Affects Versions: 3.5.0
>            Reporter: Yang Jie
>            Assignee: Yang Jie
>            Priority: Minor
>
> [https://github.com/junit-team/junit4/wiki/Exception-testing]
>  
> {code:java}
> The expected parameter should be used with care. The above test will pass if any code in the method throws IndexOutOfBoundsException. Using the method you also cannot test the value of the message in the exception, or the state of a domain object after the exception has been thrown.For these reasons, the previous approaches are recommended. {code}



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org