|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object hw2.test.BoxTest
public class BoxTest
BoxTest is a glassbox test of the Box class. Recall that like a BallContainer, the Box is a container for Balls and you can only put a Ball into a Box once. After you put the Ball into the Box, further attempts to do so will fail, since the Ball is already in the Box! Similarly, you cannot expect to remove a Ball from a Box if it is not inside the Box. In addition, a Box differs from a ballcontainer because it only has a finite volume. As Balls get put into a Box, it gets filled up. Once a Box is full, further attempts to put Balls into the Box will also fail.
Ball
,
BallContainer
,
Box
Constructor Summary | |
---|---|
BoxTest()
|
Method Summary | |
---|---|
static void |
setupBeforeTests()
|
void |
testAdd()
Test to check that Box.add(Ball) is implemented correctly |
void |
testClear()
Test to check that Box.clear() is implemented correctly |
void |
testContains()
Test to check that size() returns the correct number. |
void |
testGetBalls()
Test to check that Box.getBallsFromSmallest() is implemented correctly |
void |
testIterator()
Test to check that iterator() is implemented correctly. |
void |
testRemove()
Test to check that Box.remove(Ball) is implemented correctly. |
void |
testSize()
Test to check that size() returns the correct number. |
void |
testVolume()
Test to check that check that we can put a Ball into a Box |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BoxTest()
Method Detail |
---|
public static void setupBeforeTests() throws Exception
Exception
public void testAdd()
public void testGetBalls()
public void testRemove()
getBallsFromSmallest()
is implemented, remove() might have to be overridden and this
test helps ensure that remove() is not broken in the process.
public void testClear()
public void testVolume()
public void testSize()
public void testContains()
public void testIterator()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |