diff options
author | jhugunin <jhugunin> | 2003-08-01 18:53:07 +0000 |
---|---|---|
committer | jhugunin <jhugunin> | 2003-08-01 18:53:07 +0000 |
commit | 57445dd3ec8a67d06f16fe02e7c0eaefb8ea4051 (patch) | |
tree | 4797aad7b10f19d1d71c71699d3e95de0a4d9262 /docs/teaching/exercises/tests/Test.java | |
parent | a92e9c5c8c8646ec08759b7a940a6d32f2c541c6 (diff) | |
download | aspectj-57445dd3ec8a67d06f16fe02e7c0eaefb8ea4051.tar.gz aspectj-57445dd3ec8a67d06f16fe02e7c0eaefb8ea4051.zip |
Addendum to the original contribution from PARC. Three presentations:
oneHour talk
three hour tutorial
six hour tutorial including exercises
Diffstat (limited to 'docs/teaching/exercises/tests/Test.java')
-rw-r--r-- | docs/teaching/exercises/tests/Test.java | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/docs/teaching/exercises/tests/Test.java b/docs/teaching/exercises/tests/Test.java new file mode 100644 index 000000000..e4f5b60f9 --- /dev/null +++ b/docs/teaching/exercises/tests/Test.java @@ -0,0 +1,80 @@ +/* ******************************************************************* + * 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 junit.framework.*; + +public class Test extends TestCase { + public Test(String name) { super(name); } + + public static void main(String[] args) { + junit.textui.TestRunner.run(Test.class); + } + + Box bb; + Point p1; + Point p2; + Line l1; + SlothfulPoint sloth1; + Group g; + + public void setUp() { + p1 = new Point(10, 100); + p2 = new Point(20, 200); + l1 = new Line(p1, p2); + bb = new Box(5, 5, 10, 10); + sloth1 = new SlothfulPoint(0, 0); + g = new Group(p1); + } + + public final void testCreate() { + assertEquals(p1.getX(), 10); + assertEquals(p1.getY(), 100); + + assertEquals(l1.getP1(), p1); + assertEquals(l1.getP2(), p2); + } + + public final void testSetPoint() { + p1.setX(20); + assertEquals(p1.getX(), 20); + assertEquals(p1.getY(), 100); + + p1.setY(10); + assertEquals(p1.getX(), 20); + assertEquals(p1.getY(), 10); + } + + public final void testMoveLine1() { + l1.move(40, 40); + assertEquals(l1.getP1(), p1); + assertEquals(l1.getP2(), p2); + + assertEquals(p1.getX(), 50); + assertEquals(p1.getY(), 140); + + assertEquals(p2.getX(), 60); + assertEquals(p2.getY(), 240); + } + + public final void testMoveLine2() { + l1.move(-10, -10); + assertEquals(p1.getX(), 0); + assertEquals(p1.getY(), 90); + + assertEquals(p2.getX(), 10); + assertEquals(p2.getY(), 190); + } +} |