01: package example;
02:
03: import junit.framework.TestCase;
04:
05: public class MoverTest extends TestCase {
06: private Mover mover;
07:
08: public void setUp() {
09: mover = new Mover();
10: }
11:
12: public void testUp() {
13: mover.move("up", 2);
14: assertEquals("0,-2", mover.toString());
15: }
16:
17: public void testDown() {
18: mover.move("down", 2);
19: assertEquals("0,2", mover.toString());
20: }
21:
22: public void testLeft() {
23: mover.move("left", 2);
24: assertEquals("0,0", mover.toString());
25: }
26:
27: public void testRight() {
28: mover.move("right", 2);
29: assertEquals("0,0", mover.toString());
30: }
31: }
|