I'm new to JUnit testing with Java. I'm trying to do statement coverage over a method, but I don't quite understand how to get it to work when there's no input to the method and no return statement.
Method:
public void applyCost(){
this.current = this.current - this.Cost.getTotal();
if(this.current > 99f){
this.current = 99f;
}
}
My current attempt at the tests:
class applyCostTest {
@Test
void testApplyCost() {
//fail("Not yet implemented");
}
public void testLargeCurrent() {
assertEquals(current = 100f, 99f);
}
}
I currently get a popup saying that current cannot be resolved to a variable
Aucun commentaire:
Enregistrer un commentaire