In Java, the programmer can specify expected exceptions for JUnit test cases like this:
@Test(expected = ArithmeticException.class) public void omg() { int bl
Nobody mentioned that assertFailsWith() returns the value and you can check exception attributes:
@Test fun `my test`() { val exception = assertFailsWith {method()} assertThat(exception.message, equalTo("oops!")) } }