mercredi 3 août 2016

How to write junit test case for if statements to increase coverage?

I want to write junit test case for this piece of code. There is two classes A and B.

A a = new A();
B b = new B();
if(a.getL() != null){
    b.setP(a.getL());
}
if(a.getM() != null){
    b.setQ(a.getM());
}
if(a.getN() != null){
    b.setR(a.getN());
}

You can use Mockito and Powermockito.

Aucun commentaire:

Enregistrer un commentaire