Description
There are some code patterns in Java UTs:
@Test public void testAuthReplay() throws Exception { try { doSomeOperation(); fail("Should have failed"); } catch (Exception e) { assertTrue(checkException(e)); } }
or
@Test(expected = SomeException.class) public void testAuthReplay() throws Exception { try { doSomeOperation(); fail("Should have failed"); } catch (Exception e) { assertTrue(checkException(e)); throw e; } }
we can use Junit assertThrows to simplify the similar patterns