jeudi 1 juin 2017

Cover Exception statements in java unit tests

How to write unit test for this block of code

   if (!isVisible()) {
       throw new IllegalStateException("Not in xyz page");
   }
   return this.isAttached(DOT_ID);

If isVisible() is mocked to return false then how to write the unit test for the exception statement

Aucun commentaire:

Enregistrer un commentaire