import junit.framework.*; | import junit.framework.*; | ||||
public class Test extends TestCase { | public class Test extends TestCase { | ||||
public Test(String name) { super(name); } | |||||
public Test() {} | |||||
public static void main(String[] args) { | public static void main(String[] args) { | ||||
junit.textui.TestRunner.run(Test.class); | junit.textui.TestRunner.run(Test.class); |
/* ******************************************************************* | |||||
* 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()); | |||||
} | |||||
} |
import junit.framework.*; | import junit.framework.*; | ||||
public class Test2a extends TestCase { | public class Test2a extends TestCase { | ||||
public Test2a(String name) { super(name); } | |||||
public static void main(String[] args) { | public static void main(String[] args) { | ||||
junit.textui.TestRunner.run(Test.class); | junit.textui.TestRunner.run(Test.class); | ||||
} | } | ||||
public void testTooSmall() { | public void testTooSmall() { | ||||
Point p1 = new Point(10, 100); | |||||
Point p1 = new Point(10, 100); | |||||
try { | try { | ||||
p1.setX(-10); | p1.setX(-10); | ||||
fail("should have thrown IllegalArgumentException"); | fail("should have thrown IllegalArgumentException"); | ||||
} | } | ||||
public void testNotTooSmall() { | public void testNotTooSmall() { | ||||
Point p1 = new Point(10, 100); | |||||
p1.setX(0); | |||||
Point p1 = new Point(10, 100); | |||||
p1.setX(0); | |||||
} | } | ||||
public void testMove() { | public void testMove() { |
import junit.framework.*; | import junit.framework.*; | ||||
public class Test2b extends TestCase { | public class Test2b extends TestCase { | ||||
public Test2b(String name) { super(name); } | |||||
public static void main(String[] args) { | public static void main(String[] args) { | ||||
junit.textui.TestRunner.run(Test.class); | junit.textui.TestRunner.run(Test.class); | ||||
junit.textui.TestRunner.run(Test2b.class); | junit.textui.TestRunner.run(Test2b.class); | ||||
Group g = new Group(p1); | Group g = new Group(p1); | ||||
Point p2 = new Point(20, 200); | Point p2 = new Point(20, 200); | ||||
g.add(p2); | |||||
g.add(p2); | |||||
} | } | ||||
} | } |
import junit.framework.*; | import junit.framework.*; | ||||
public class Test2c extends TestCase { | public class Test2c extends TestCase { | ||||
public Test2c(String name) { super(name); } | |||||
public static void main(String[] args) { | public static void main(String[] args) { | ||||
junit.textui.TestRunner.run(Test.class); | junit.textui.TestRunner.run(Test.class); |
import junit.framework.*; | import junit.framework.*; | ||||
public class Test2d extends TestCase { | public class Test2d extends TestCase { | ||||
public Test2d(String name) { super(name); } | |||||
public static void main(String[] args) { | public static void main(String[] args) { | ||||
junit.textui.TestRunner.run(Test.class); | junit.textui.TestRunner.run(Test.class); |
import junit.framework.*; | import junit.framework.*; | ||||
public class Test2e extends TestCase { | public class Test2e extends TestCase { | ||||
public Test2e(String name) { super(name); } | |||||
public static void main(String[] args) { | public static void main(String[] args) { | ||||
junit.textui.TestRunner.run(Test.class); | junit.textui.TestRunner.run(Test.class); | ||||
junit.textui.TestRunner.run(Test2e.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 { | try { | ||||
sp.move(10, 10); | sp.move(10, 10); | ||||
fail("should have thrown IllegalStateException"); | fail("should have thrown IllegalStateException"); | ||||
} catch (IllegalStateException e) { } | } 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); | p1.move(3, 30); | ||||
} | } | ||||
} | } |
import junit.framework.*; | import junit.framework.*; | ||||
public class Test2f extends Test { | public class Test2f extends Test { | ||||
public Test2f(String name) { super(name); } | |||||
public static void main(String[] args) { | public static void main(String[] args) { | ||||
junit.textui.TestRunner.run(Test.class); | junit.textui.TestRunner.run(Test.class); |
import junit.framework.*; | import junit.framework.*; | ||||
public class Test3a extends Test { | public class Test3a extends Test { | ||||
public Test3a(String name) { super(name); } | |||||
public static void main(String[] args) { | public static void main(String[] args) { | ||||
junit.textui.TestRunner.run(Test3a.class); | junit.textui.TestRunner.run(Test3a.class); |
import junit.framework.*; | import junit.framework.*; | ||||
public class Test3b extends Test { | public class Test3b extends Test { | ||||
public Test3b(String name) { super(name); } | |||||
public static void main(String[] args) { | public static void main(String[] args) { | ||||
junit.textui.TestRunner.run(Test3b.class); | junit.textui.TestRunner.run(Test3b.class); |
import junit.framework.*; | import junit.framework.*; | ||||
public class Test3c extends Test { | public class Test3c extends Test { | ||||
public Test3c(String name) { super(name); } | |||||
public static void main(String[] args) { | public static void main(String[] args) { | ||||
junit.textui.TestRunner.run(Test3c.class); | junit.textui.TestRunner.run(Test3c.class); |
public class Test4d extends Test { | public class Test4d extends Test { | ||||
public Test4d(String name) { super(name); } | |||||
public static void main(String[] args) { | public static void main(String[] args) { | ||||
junit.textui.TestRunner.run(Test4d.class); | junit.textui.TestRunner.run(Test4d.class); | ||||
} | } |
public class Test4e extends Test { | public class Test4e extends Test { | ||||
public Test4e(String name) { super(name); } | |||||
public static void main(String[] args) { | public static void main(String[] args) { | ||||
junit.textui.TestRunner.run(Test4e.class); | junit.textui.TestRunner.run(Test4e.class); | ||||
} | } |