@Test(expected = "WhateverException.class")
, but the only drawback is that you can't test the exception's message. A way to test the expected exception as well as the expected message is to use the
@Rule
annotation with ExpectedException
.Here is an example.
No comments:
Post a Comment