I have just started learning JUnit testing. I have to write test for methoods below. I started from testting zero(). Can you tell me what i do wrongly there? And leave some helpful examples how should i test rest of this methods?
private Accumulator a;
int acc;
public void test()
{
Kalkulator test = new Kalkulator();
int result = test.zero(); // my error: MULTIPLE MARKERS
assertEquals(0,result);
}
// Methoods
public void setAccumulator( Accumulator a ){
this.a = a;
acc = a.get();
}
public Accumulator getAccumulator(){
return a;
}
public int get(){
return acc;
}
public void zero(){
acc = 0;
}
//***get***
public int get()
{
return acc;
}
Aucun commentaire:
Enregistrer un commentaire