vendredi 28 août 2015

How to test method condition using mockito

Mockito is used to mock object behavior but how do I check if the condition match if the method call is not an object call.

For example

boolean sameType= bloodType != null && bloodType.type.equals(patient.type);
if (sameType && transfusion(availability)) {
return true;
}

if (sameType && availability <= 0) {
reject.rejectBlood(info);
return false;
}

how do I cover those using mockito?

Aucun commentaire:

Enregistrer un commentaire