dimanche 16 octobre 2016

Testing if blocks with Mockito

I have void function that does not return return anything with a if block inside. Is there a way while unit testing to verify if the "if" block is touched?

for example to test the "if" inside the following funtion:

public void doSomething(){
    if(someCondition){
        int foo = doThis();
    }
    // ---- 
    // remaining code
} 

private int doThis(){
    return 100;
}

Aucun commentaire:

Enregistrer un commentaire