I wrote a Junit test to unit test my code. I want my Junit test case to fail when I get any exception in my code. I tried using an assert statement, but even when I get an exception in my code, my Junit test case is passing. Please can anyone tell me how I can achieve this? Thanks.
You can assert that a global variable “excepted” = null or something like that and initialize it to equal some information string in the catch block.