Snippets tagged “test-annotation”
1 snippet uses this tag.
- How to assert that a certain exception is thrown in JUnit tests?Java
To assert that a certain exception is thrown in a JUnit test, you can use the @Test annotation's expected attribute. Here's an example: