Yang Jie created SPARK-38694: -------------------------------- Summary: Simplify Java UT code with Junit `assertThrows` Key: SPARK-38694 URL: https://issues.apache.org/jira/browse/SPARK-38694 Project: Spark Issue Type: Improvement Components: Tests Affects Versions: 3.4.0 Reporter: Yang Jie
There are some code patterns in Java UTs: {code:java} @Test public void testAuthReplay() throws Exception { try { doSomeOperation(); fail("Should have failed"); } catch (Exception e) { assertTrue(checkException(e)); } } {code} or {code:java} @Test(expected = SomeException.class) public void testAuthReplay() throws Exception { try { doSomeOperation(); fail("Should have failed"); } catch (Exception e) { assertTrue(checkException(e)); throw e; } } {code} we can use Junit assertThrows to simplify the similar patterns -- This message was sent by Atlassian Jira (v8.20.1#820001) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org