@@ -16,10 +16,9 @@ import figures.*; | |||
import junit.framework.*; | |||
public class Test2a extends TestCase { | |||
public class Test2a extends Test { | |||
public static void main(String[] args) { | |||
junit.textui.TestRunner.run(Test.class); | |||
junit.textui.TestRunner.run(Test2a.class); | |||
} | |||
@@ -16,9 +16,9 @@ import figures.*; | |||
import junit.framework.*; | |||
public class Test2b extends TestCase { | |||
public class Test2b extends Test { | |||
public static void main(String[] args) { | |||
junit.textui.TestRunner.run(Test.class); | |||
junit.textui.TestRunner.run(Test2b.class); | |||
} | |||
@@ -16,11 +16,9 @@ import figures.*; | |||
import junit.framework.*; | |||
public class Test2c extends TestCase { | |||
public class Test2c extends Test { | |||
public static void main(String[] args) { | |||
junit.textui.TestRunner.run(Test.class); | |||
junit.textui.TestRunner.run(Test2b.class); | |||
junit.textui.TestRunner.run(Test2c.class); | |||
} | |||
@@ -16,10 +16,9 @@ import figures.*; | |||
import junit.framework.*; | |||
public class Test2d extends TestCase { | |||
public class Test2d extends Test { | |||
public static void main(String[] args) { | |||
junit.textui.TestRunner.run(Test.class); | |||
junit.textui.TestRunner.run(Test2d.class); | |||
} | |||
@@ -16,10 +16,9 @@ import figures.*; | |||
import junit.framework.*; | |||
public class Test2e extends TestCase { | |||
public class Test2e extends Test { | |||
public static void main(String[] args) { | |||
junit.textui.TestRunner.run(Test.class); | |||
junit.textui.TestRunner.run(Test2e.class); | |||
} | |||
@@ -19,7 +19,6 @@ import junit.framework.*; | |||
public class Test2f extends Test { | |||
public static void main(String[] args) { | |||
junit.textui.TestRunner.run(Test.class); | |||
junit.textui.TestRunner.run(Test2f.class); | |||
} | |||
@@ -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); | |||
} | |||
} |
@@ -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); | |||
} | |||
} |
@@ -14,8 +14,9 @@ package tests; | |||
import figures.*; | |||
import support.Log; | |||
import junit.framework.*; | |||
import java.util.List; | |||
import java.util.Arrays; | |||
public class Test3c extends Test { | |||
@@ -23,24 +24,29 @@ public class Test3c extends Test { | |||
junit.textui.TestRunner.run(Test3c.class); | |||
} | |||
public void setUp() { | |||
public void testCreateWithPointLog() { | |||
Log.clear(); | |||
super.setUp(); | |||
} | |||
public void testCreateLog() { | |||
assertEquals("", Log.getString()); | |||
Point p1 = new Point(10, 100); | |||
Group g = new Group(p1); | |||
List foundLog = Log.getData(); | |||
List desiredLog = | |||
Arrays.asList(new String[] { | |||
"adding Point" | |||
}); | |||
assertEquals(desiredLog, foundLog); | |||
} | |||
public void testMoveLonePoint() { | |||
p1 = new Point(0, 0); | |||
p1.move(37, 88); | |||
assertEquals("moving as a part of null;", Log.getString()); | |||
} | |||
public void testMoveGroupedPoint() { | |||
g = new Group(p1); | |||
p1.move(0, 0); | |||
assertEquals("moving as a part of " + g + ";", Log.getString()); | |||
public void testCreateWithoutPointLog() { | |||
Log.clear(); | |||
Point p1 = new Point(10, 100); | |||
Point p2 = new Point(20, 200); | |||
Line l = new Line(p1, p2); | |||
Group g = new Group(l); | |||
List foundLog = Log.getData(); | |||
List desiredLog = Arrays.asList(new String[] {}); | |||
assertEquals(desiredLog, foundLog); | |||
} | |||
} | |||
@@ -18,6 +18,7 @@ import java.awt.Rectangle; | |||
import junit.framework.*; | |||
public class Test4a extends Test { | |||
public static void main(String[] args) { | |||
junit.textui.TestRunner.run(Test4a.class); | |||
} |
@@ -18,6 +18,7 @@ import java.awt.Rectangle; | |||
import junit.framework.*; | |||
public class Test4b extends Test { | |||
public static void main(String[] args) { | |||
junit.textui.TestRunner.run(Test4b.class); | |||
} |
@@ -18,6 +18,7 @@ import java.awt.Rectangle; | |||
import junit.framework.*; | |||
public class Test4c extends Test { | |||
public static void main(String[] args) { | |||
junit.textui.TestRunner.run(Test4c.class); | |||
} |