diff options
Diffstat (limited to 'docs/teaching/exercises/tests/Test3a.java')
-rw-r--r-- | docs/teaching/exercises/tests/Test3a.java | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/docs/teaching/exercises/tests/Test3a.java b/docs/teaching/exercises/tests/Test3a.java index 4db5450e9..84964d1e8 100644 --- a/docs/teaching/exercises/tests/Test3a.java +++ b/docs/teaching/exercises/tests/Test3a.java @@ -14,8 +14,9 @@ package tests; import figures.*; import support.Log; - import junit.framework.*; +import java.util.List; +import java.util.Arrays; public class Test3a extends Test { @@ -23,26 +24,36 @@ public class Test3a extends Test { junit.textui.TestRunner.run(Test3a.class); } - public void setUp() { + public void testMovePointLog() { + Point p1 = new Point(10, 100); + Log.clear(); - super.setUp(); - } + p1.move(20, 30); + List foundLog = Log.getData(); - public void testCreateLog() { - assertEquals("", Log.getString()); - } + List desiredLog = + Arrays.asList(new String[] { + "execution(void figures.Point.move(int, int))" + }); - public void testMovePointLog() { - p1.move(20, 30); - assertEquals("moving;", Log.getString()); + assertEquals(desiredLog, foundLog); } - public void testSetYPointLog() { - assertEquals("", Log.getString()); - } + public void testMoveLineLog() { + Point p1 = new Point(10, 100); + Point p2 = new Point(20, 200); + Line l = new Line(p1, p2); - public void testGetYPointLog() { - p1.getY(); - assertEquals("", Log.getString()); + Log.clear(); + l.move(20, 30); + List foundLog = Log.getData(); + + List desiredLog = + Arrays.asList(new String[] { + "execution(void figures.Line.move(int, int))", + "execution(void figures.Point.move(int, int))", + "execution(void figures.Point.move(int, int))" + }); + assertEquals(desiredLog, foundLog); } } |