I have a method named execute() which does something and returns a boolean. Under normal situations, it returns true, but if there is an exception, (say, DataAccessException) it will capture the exception and return false.
I am trying to figure out how to test the scenario in which an exception is raised and "false" is returned, using Hamcrest.
So, here it is:
public boolean execute() {
try { ....... return true;}
catch (DataAccessException de) { ....... return false;}
}
Aucun commentaire:
Enregistrer un commentaire