What is expected exception?
The ExpectedException rule would let the user verify if their code throws a particular exception. When we raise certain exception, the tests. It would show an error message if we rise another exception. When there is no exception, it would ultimately fail.
Learn how to leverage expectMessage method of org.junit.rules.ExpectedException class