From f3929cad6a0e6d6973483dd23c7aea68b6e7fed1 Mon Sep 17 00:00:00 2001 From: ehilsdal Date: Thu, 28 Aug 2003 15:11:12 +0000 Subject: updated section 2 --- docs/teaching/exercises/tests/Test2c.java | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'docs/teaching/exercises/tests/Test2c.java') diff --git a/docs/teaching/exercises/tests/Test2c.java b/docs/teaching/exercises/tests/Test2c.java index 153739fc0..01c4978e4 100644 --- a/docs/teaching/exercises/tests/Test2c.java +++ b/docs/teaching/exercises/tests/Test2c.java @@ -16,30 +16,31 @@ import figures.*; import junit.framework.*; -public class Test2c extends Test { +public class Test2c extends TestCase { public Test2c(String name) { super(name); } public static void main(String[] args) { + junit.textui.TestRunner.run(Test.class); + junit.textui.TestRunner.run(Test2b.class); junit.textui.TestRunner.run(Test2c.class); } - public void setUp() { - super.setUp(); - } + public void testSelf() { + Point p1 = new Point(10, 100); + Group g = new Group(p1); - public void testNull() { try { - g.add(null); + g.add(g); fail("should have thrown IllegalArgumentException"); } catch (IllegalArgumentException ea) { } } - public void testSelf() { - try { - g.add(g); - fail("should have thrown IllegalArgumentException"); - } catch (IllegalArgumentException ea) { - } + public void testNotSelf() { + Point p1 = new Point(10, 100); + Group g1 = new Group(p1); + Group g2 = new Group(p1); + + g1.add(g2); } } -- cgit v1.2.3