lundi 26 décembre 2016

how do you test simple if else statements with J-unit?

I have this if else statement and i want to write a J unit test that will test each individual line to see is correct. Any ideas?

public class Testings {

public static int computeValue(int x, int y, int z)
{
        int value = 0;

        if ( x == y ) 
            value = x + 1;
        else if (( x > y) && ( z == 0))
            value = y + 2;
        else
            value = z;

        return value;
}

}

Aucun commentaire:

Enregistrer un commentaire