mardi 31 mai 2016

Auto generated test case failing in netbeans

I have a Calculator class which has a method to add two numbers.

public class Calc {
    public int add(int a, int b){
        return a+b;
    }
}

I created its Test class using netbeans context menu Tools->create tests which is failing. I can't figure out why.

@Test
public void testAdd() {
    System.out.println("add");
    int a = 0;
    int b = 0;
    Calc instance = new Calc();
    int expResult = 0;
    int result = instance.add(a, b);
    assertEquals(expResult, result);
}

Aucun commentaire:

Enregistrer un commentaire