how can unit constructor?
private item[] items; private int currentindex; /** * default constructor */ public inventory() { this.items = new item[1]; this.currentindex = 0; }
it's standard practice make non-public test members , fields package private. this,
item[] items; int currentindex; public inventory() { this.items = new item[1]; this.currentindex = 0; }
now long unit test in same package inventory
class,
public void testctor() { inventory = new inventory(); assertnotnull(i.items); assertequal(1, i.items.length); assertequal(0, i.currentindex); }
Comments
Post a Comment