summaryrefslogtreecommitdiffstats
path: root/docs/teaching/exercises/tests/Test3b.java
diff options
context:
space:
mode:
Diffstat (limited to 'docs/teaching/exercises/tests/Test3b.java')
-rw-r--r--docs/teaching/exercises/tests/Test3b.java48
1 files changed, 27 insertions, 21 deletions
diff --git a/docs/teaching/exercises/tests/Test3b.java b/docs/teaching/exercises/tests/Test3b.java
index c722bce7c..ccf792001 100644
--- a/docs/teaching/exercises/tests/Test3b.java
+++ b/docs/teaching/exercises/tests/Test3b.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 Test3b extends Test {
@@ -23,31 +24,36 @@ public class Test3b extends Test {
junit.textui.TestRunner.run(Test3b.class);
}
- public void setUp() {
- super.setUp();
+ public void testMovePointLog() {
+ Point p1 = new Point(10, 100);
+
Log.clear();
- }
+ 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)) at Point(10, 100)"
+ });
- public void testCreateWithPointLog() {
- g = new Group(p1);
- assertEquals("adding Point;", Log.getString());
+ assertEquals(desiredLog, foundLog);
}
- public void testCreateWithoutPointLog() {
- g = new Group(l1);
- 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 testAddPointLog() {
- g.add(p1);
- assertEquals("adding Point;", Log.getString());
- }
- public void testAddNonPointLog() {
- g.add(l1);
- 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)) at Line(Point(10, 100), Point(20, 200))",
+ "execution(void figures.Point.move(int, int)) at Point(10, 100)",
+ "execution(void figures.Point.move(int, int)) at Point(20, 200)"
+ });
+ assertEquals(desiredLog, foundLog);
}
}