diff options
Diffstat (limited to 'docs/teaching/exercises')
-rw-r--r-- | docs/teaching/exercises/tests/Test.java | 2 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test1a.java | 55 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test2a.java | 7 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test2b.java | 4 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test2c.java | 1 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test2d.java | 1 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test2e.java | 9 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test2f.java | 1 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test3a.java | 1 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test3b.java | 1 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test3c.java | 1 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test4d.java | 2 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test4e.java | 2 |
13 files changed, 8 insertions, 79 deletions
diff --git a/docs/teaching/exercises/tests/Test.java b/docs/teaching/exercises/tests/Test.java index d6d3bb4e6..101dc8c55 100644 --- a/docs/teaching/exercises/tests/Test.java +++ b/docs/teaching/exercises/tests/Test.java @@ -17,8 +17,6 @@ import figures.*; import junit.framework.*; public class Test extends TestCase { - public Test(String name) { super(name); } - public Test() {} public static void main(String[] args) { junit.textui.TestRunner.run(Test.class); diff --git a/docs/teaching/exercises/tests/Test1a.java b/docs/teaching/exercises/tests/Test1a.java deleted file mode 100644 index 147a899e5..000000000 --- a/docs/teaching/exercises/tests/Test1a.java +++ /dev/null @@ -1,55 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Common Public License v1.0 - * which accompanies this distribution and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * PARC initial implementation - * ******************************************************************/ - -package tests; - -import figures.*; -import support.Log; - -import junit.framework.*; - -public class Test1a extends Test { - public Test1a(String name) { super(name); } - - public static void main(String[] args) { - junit.textui.TestRunner.run(Test1a.class); - } - - public void setUp() { - Log.clear(); - super.setUp(); - } - - public void testCreateLog() { - assertEquals("", Log.getString()); - } - - public void testSetXPointLog() { - p1.setX(20); - assertEquals("set;", Log.getString()); - } - - public void testSetYPointLog() { - p1.setY(10); - assertEquals("", Log.getString()); - } - - public void testGetYPointLog() { - p1.getY(); - assertEquals("", Log.getString()); - } - - public void testMoveLineLog() { - l1.move(40, 40); - assertEquals("", Log.getString()); - } -} diff --git a/docs/teaching/exercises/tests/Test2a.java b/docs/teaching/exercises/tests/Test2a.java index 4bc6dd28a..ece7191b7 100644 --- a/docs/teaching/exercises/tests/Test2a.java +++ b/docs/teaching/exercises/tests/Test2a.java @@ -17,7 +17,6 @@ import figures.*; import junit.framework.*; public class Test2a extends TestCase { - public Test2a(String name) { super(name); } public static void main(String[] args) { junit.textui.TestRunner.run(Test.class); @@ -25,7 +24,7 @@ public class Test2a extends TestCase { } public void testTooSmall() { - Point p1 = new Point(10, 100); + Point p1 = new Point(10, 100); try { p1.setX(-10); fail("should have thrown IllegalArgumentException"); @@ -34,8 +33,8 @@ public class Test2a extends TestCase { } public void testNotTooSmall() { - Point p1 = new Point(10, 100); - p1.setX(0); + Point p1 = new Point(10, 100); + p1.setX(0); } public void testMove() { diff --git a/docs/teaching/exercises/tests/Test2b.java b/docs/teaching/exercises/tests/Test2b.java index 822c8de74..be53f09f3 100644 --- a/docs/teaching/exercises/tests/Test2b.java +++ b/docs/teaching/exercises/tests/Test2b.java @@ -17,8 +17,6 @@ import figures.*; import junit.framework.*; public class Test2b extends TestCase { - public Test2b(String name) { super(name); } - public static void main(String[] args) { junit.textui.TestRunner.run(Test.class); junit.textui.TestRunner.run(Test2b.class); @@ -40,7 +38,7 @@ public class Test2b extends TestCase { Group g = new Group(p1); Point p2 = new Point(20, 200); - g.add(p2); + g.add(p2); } } diff --git a/docs/teaching/exercises/tests/Test2c.java b/docs/teaching/exercises/tests/Test2c.java index 01c4978e4..eef336ea2 100644 --- a/docs/teaching/exercises/tests/Test2c.java +++ b/docs/teaching/exercises/tests/Test2c.java @@ -17,7 +17,6 @@ import figures.*; import junit.framework.*; public class Test2c extends TestCase { - public Test2c(String name) { super(name); } public static void main(String[] args) { junit.textui.TestRunner.run(Test.class); diff --git a/docs/teaching/exercises/tests/Test2d.java b/docs/teaching/exercises/tests/Test2d.java index cc8d7f51c..6409e8c8e 100644 --- a/docs/teaching/exercises/tests/Test2d.java +++ b/docs/teaching/exercises/tests/Test2d.java @@ -17,7 +17,6 @@ import figures.*; import junit.framework.*; public class Test2d extends TestCase { - public Test2d(String name) { super(name); } public static void main(String[] args) { junit.textui.TestRunner.run(Test.class); diff --git a/docs/teaching/exercises/tests/Test2e.java b/docs/teaching/exercises/tests/Test2e.java index 09ab65790..6ec31d608 100644 --- a/docs/teaching/exercises/tests/Test2e.java +++ b/docs/teaching/exercises/tests/Test2e.java @@ -17,23 +17,22 @@ import figures.*; import junit.framework.*; public class Test2e extends TestCase { - public Test2e(String name) { super(name); } public static void main(String[] args) { junit.textui.TestRunner.run(Test.class); junit.textui.TestRunner.run(Test2e.class); } - public void testSloth() { - Point sp = new SlothfulPoint(10, 10); + public void testNonMoving() { + Point sp = new Point(10, 10) { public void move(int x, int y) {} }; try { sp.move(10, 10); fail("should have thrown IllegalStateException"); } catch (IllegalStateException e) { } } - public void testNonSloth() { - Point p1 = new Point(10, 100); + public void testMoving() { + Point p1 = new Point(10, 100); p1.move(3, 30); } } diff --git a/docs/teaching/exercises/tests/Test2f.java b/docs/teaching/exercises/tests/Test2f.java index 1b90d268a..30dfa7fa1 100644 --- a/docs/teaching/exercises/tests/Test2f.java +++ b/docs/teaching/exercises/tests/Test2f.java @@ -17,7 +17,6 @@ import figures.*; import junit.framework.*; public class Test2f extends Test { - public Test2f(String name) { super(name); } public static void main(String[] args) { junit.textui.TestRunner.run(Test.class); diff --git a/docs/teaching/exercises/tests/Test3a.java b/docs/teaching/exercises/tests/Test3a.java index 33afa3a82..4db5450e9 100644 --- a/docs/teaching/exercises/tests/Test3a.java +++ b/docs/teaching/exercises/tests/Test3a.java @@ -18,7 +18,6 @@ import support.Log; import junit.framework.*; public class Test3a extends Test { - public Test3a(String name) { super(name); } public static void main(String[] args) { junit.textui.TestRunner.run(Test3a.class); diff --git a/docs/teaching/exercises/tests/Test3b.java b/docs/teaching/exercises/tests/Test3b.java index 1e8e8bd4d..c722bce7c 100644 --- a/docs/teaching/exercises/tests/Test3b.java +++ b/docs/teaching/exercises/tests/Test3b.java @@ -18,7 +18,6 @@ import support.Log; import junit.framework.*; public class Test3b extends Test { - public Test3b(String name) { super(name); } public static void main(String[] args) { junit.textui.TestRunner.run(Test3b.class); diff --git a/docs/teaching/exercises/tests/Test3c.java b/docs/teaching/exercises/tests/Test3c.java index 292a0213d..a8d888366 100644 --- a/docs/teaching/exercises/tests/Test3c.java +++ b/docs/teaching/exercises/tests/Test3c.java @@ -18,7 +18,6 @@ import support.Log; import junit.framework.*; public class Test3c extends Test { - public Test3c(String name) { super(name); } public static void main(String[] args) { junit.textui.TestRunner.run(Test3c.class); diff --git a/docs/teaching/exercises/tests/Test4d.java b/docs/teaching/exercises/tests/Test4d.java index 234422235..c4f21ff91 100644 --- a/docs/teaching/exercises/tests/Test4d.java +++ b/docs/teaching/exercises/tests/Test4d.java @@ -19,8 +19,6 @@ import junit.framework.*; public class Test4d extends Test { - public Test4d(String name) { super(name); } - public static void main(String[] args) { junit.textui.TestRunner.run(Test4d.class); } diff --git a/docs/teaching/exercises/tests/Test4e.java b/docs/teaching/exercises/tests/Test4e.java index 3fe4689ee..d19beb71b 100644 --- a/docs/teaching/exercises/tests/Test4e.java +++ b/docs/teaching/exercises/tests/Test4e.java @@ -19,8 +19,6 @@ import junit.framework.*; public class Test4e extends Test { - public Test4e(String name) { super(name); } - public static void main(String[] args) { junit.textui.TestRunner.run(Test4e.class); } |