|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcs1705.TestableWorld
This class provides the basic assertion capabilities for Karel's
World in the form of methods useful for writing test cases.
Consider using World instead of referring to
this class directly.
Note that, although this class cannot be directly instantiated,
all of its methods are non-static. That is because these assertions
were designed for use with BlueJ's JUnit support. You can use
World.getWorldAsObject() or TestableRobot.getWorldAsObject()
to get a reference to a unique global instance of the world object,
and then call these methods on it directly.
| Constructor Summary | |
TestableWorld()
This class should not be instantiated--it only provides static methods that can be called without an object. |
|
| Method Summary | |
void |
assertBeepersAt(int street,
int avenue)
Fail if there are no beepers at the given intersection. |
void |
assertBeepersAt(int street,
int avenue,
int count)
Fail if the number of beepers at the given intersection is different than the specified count. |
void |
assertBeepersInWorld()
Fail if there are no beepers anywhere in this world. |
void |
assertBeepersInWorld(int count)
Fail if the total number of beepers in this world, regardless of their location, is different than the specified count. |
void |
assertEWWallAt(int northOfStreet,
int crossingAvenue)
Fail if there is no east/west wall at the given location. |
void |
assertNoBeepersAt(int street,
int avenue)
Fail if there is at least one beeper at the given intersection. |
void |
assertNoBeepersInWorld()
Fail if there are any beepers anywhere in this world. |
void |
assertNoEWWallAt(int northOfStreet,
int crossingAvenue)
Fail if there is an east/west wall at the given intersection. |
void |
assertNoNSWallAt(int crossingStreet,
int eastOfAvenue)
Fail if there is a north/south wall at the given location. |
void |
assertNoRobotsInWorld()
Fail if there are any robots anywhere in this world. |
void |
assertNSWallAt(int crossingStreet,
int eastOfAvenue)
Fail if there is no north/south wall at the given location. |
void |
assertRobotsInWorld()
Fail if there are no robots anywhere in this world. |
void |
assertRobotsInWorld(int count)
Fail if the total number of robots in this world, regardless of their location, is different than the specified count. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public TestableWorld()
| Method Detail |
public void assertBeepersAt(int street,
int avenue)
street - the street number to check atavenue - the avenue number to check at
public void assertBeepersAt(int street,
int avenue,
int count)
street - the street number to check atavenue - the avenue number to check atcount - the number of beepers to check forpublic void assertBeepersInWorld()
public void assertBeepersInWorld(int count)
Directions.infinity (-1).
count - the number of beepers expected
public void assertEWWallAt(int northOfStreet,
int crossingAvenue)
northOfStreet - the street number to check atcrossingAvenue - the avenue number to check at
public void assertNoBeepersAt(int street,
int avenue)
street - the street number to check atavenue - the avenue number to check atpublic void assertNoBeepersInWorld()
public void assertNoEWWallAt(int northOfStreet,
int crossingAvenue)
northOfStreet - the street number to check atcrossingAvenue - the avenue number to check at
public void assertNoNSWallAt(int crossingStreet,
int eastOfAvenue)
crossingStreet - the street number to check ateastOfAvenue - the avenue number to check atpublic void assertNoRobotsInWorld()
public void assertNSWallAt(int crossingStreet,
int eastOfAvenue)
crossingStreet - the street number to check ateastOfAvenue - the avenue number to check atpublic void assertRobotsInWorld()
public void assertRobotsInWorld(int count)
count - the number of robots expected
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||