Yang Jie created SPARK-44314:
--------------------------------

             Summary: 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


[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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to