DEV Community

Discussion on: My first ever unit test

Collapse
 
alfanse profile image
Alex

Please consider removing the try catch from your example. It risks a false positive test result.

You may simply have the test method signature throw Exception.

Collapse
 
cathodion profile image
Dustin King

I was going to say this too. I'm not familiar with Mockito, but test frameworks I've used in the past use exceptions to signal to the test runner when the assertion fails.

Collapse
 
bassemibrahim profile image
Bassem

Will definitely consider that thanks.