diff options
author | ehilsdal <ehilsdal> | 2003-08-27 20:21:03 +0000 |
---|---|---|
committer | ehilsdal <ehilsdal> | 2003-08-27 20:21:03 +0000 |
commit | 9ae0cfecd5fa4cc15c30c2231ba5b7de2a86e882 (patch) | |
tree | a0e292b5e6cebf50c12ed7742540747c838cc96f /docs/teaching/exercises/tests | |
parent | 910f2658b1342cd4a3b22169895c71fa8b48279c (diff) | |
download | aspectj-9ae0cfecd5fa4cc15c30c2231ba5b7de2a86e882.tar.gz aspectj-9ae0cfecd5fa4cc15c30c2231ba5b7de2a86e882.zip |
untabified
Diffstat (limited to 'docs/teaching/exercises/tests')
-rw-r--r-- | docs/teaching/exercises/tests/Test.java | 32 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test1a.java | 24 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test2a.java | 16 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test2b.java | 18 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test2c.java | 20 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test2d.java | 18 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test2e.java | 18 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test2f.java | 16 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test2g.java | 16 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test2h.java | 16 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test3a.java | 20 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test3b.java | 24 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test3c.java | 24 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test4a.java | 20 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test4b.java | 58 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test4c.java | 100 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test4d.java | 82 | ||||
-rw-r--r-- | docs/teaching/exercises/tests/Test4e.java | 56 |
18 files changed, 289 insertions, 289 deletions
diff --git a/docs/teaching/exercises/tests/Test.java b/docs/teaching/exercises/tests/Test.java index e4f5b60f9..17d8b12e6 100644 --- a/docs/teaching/exercises/tests/Test.java +++ b/docs/teaching/exercises/tests/Test.java @@ -1,13 +1,13 @@ /* ******************************************************************* * 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 + * 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; @@ -31,12 +31,12 @@ public class Test extends TestCase { Group g; public void setUp() { - p1 = new Point(10, 100); - p2 = new Point(20, 200); - l1 = new Line(p1, p2); + 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); + g = new Group(p1); } public final void testCreate() { @@ -48,17 +48,17 @@ public class Test extends TestCase { } public final void testSetPoint() { - p1.setX(20); + p1.setX(20); assertEquals(p1.getX(), 20); assertEquals(p1.getY(), 100); - p1.setY(10); + p1.setY(10); assertEquals(p1.getX(), 20); assertEquals(p1.getY(), 10); } public final void testMoveLine1() { - l1.move(40, 40); + l1.move(40, 40); assertEquals(l1.getP1(), p1); assertEquals(l1.getP2(), p2); @@ -70,7 +70,7 @@ public class Test extends TestCase { } public final void testMoveLine2() { - l1.move(-10, -10); + l1.move(-10, -10); assertEquals(p1.getX(), 0); assertEquals(p1.getY(), 90); diff --git a/docs/teaching/exercises/tests/Test1a.java b/docs/teaching/exercises/tests/Test1a.java index b8bb2e120..147a899e5 100644 --- a/docs/teaching/exercises/tests/Test1a.java +++ b/docs/teaching/exercises/tests/Test1a.java @@ -1,13 +1,13 @@ /* ******************************************************************* * 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 + * 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; @@ -34,22 +34,22 @@ public class Test1a extends Test { } public void testSetXPointLog() { - p1.setX(20); + p1.setX(20); assertEquals("set;", Log.getString()); } public void testSetYPointLog() { - p1.setY(10); + p1.setY(10); assertEquals("", Log.getString()); } public void testGetYPointLog() { - p1.getY(); + p1.getY(); assertEquals("", Log.getString()); } public void testMoveLineLog() { - l1.move(40, 40); + l1.move(40, 40); assertEquals("", Log.getString()); } } diff --git a/docs/teaching/exercises/tests/Test2a.java b/docs/teaching/exercises/tests/Test2a.java index 21ce08a9f..0b737020b 100644 --- a/docs/teaching/exercises/tests/Test2a.java +++ b/docs/teaching/exercises/tests/Test2a.java @@ -1,13 +1,13 @@ /* ******************************************************************* * 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 + * 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; diff --git a/docs/teaching/exercises/tests/Test2b.java b/docs/teaching/exercises/tests/Test2b.java index 63a10b7b0..e127b5cc4 100644 --- a/docs/teaching/exercises/tests/Test2b.java +++ b/docs/teaching/exercises/tests/Test2b.java @@ -1,13 +1,13 @@ /* ******************************************************************* * 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 + * 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; @@ -29,7 +29,7 @@ public class Test2b extends Test { public void testNull() { try { - g.add(null); + g.add(null); fail("should have thrown IllegalArgumentException"); } catch (IllegalArgumentException ea) { } diff --git a/docs/teaching/exercises/tests/Test2c.java b/docs/teaching/exercises/tests/Test2c.java index cfcb0d1d8..153739fc0 100644 --- a/docs/teaching/exercises/tests/Test2c.java +++ b/docs/teaching/exercises/tests/Test2c.java @@ -1,13 +1,13 @@ /* ******************************************************************* * 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 + * 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; @@ -29,7 +29,7 @@ public class Test2c extends Test { public void testNull() { try { - g.add(null); + g.add(null); fail("should have thrown IllegalArgumentException"); } catch (IllegalArgumentException ea) { } @@ -37,7 +37,7 @@ public class Test2c extends Test { public void testSelf() { try { - g.add(g); + g.add(g); fail("should have thrown IllegalArgumentException"); } catch (IllegalArgumentException ea) { } diff --git a/docs/teaching/exercises/tests/Test2d.java b/docs/teaching/exercises/tests/Test2d.java index 89e47c088..b8056fbf3 100644 --- a/docs/teaching/exercises/tests/Test2d.java +++ b/docs/teaching/exercises/tests/Test2d.java @@ -1,13 +1,13 @@ /* ******************************************************************* * 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 + * 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; @@ -29,7 +29,7 @@ public class Test2d extends Test { public void testSetting() { try { - sloth1.setX(10); + sloth1.setX(10); fail("should have thrown RuntimeException"); } catch (RuntimeException ea) { } diff --git a/docs/teaching/exercises/tests/Test2e.java b/docs/teaching/exercises/tests/Test2e.java index 57af08501..dfa456138 100644 --- a/docs/teaching/exercises/tests/Test2e.java +++ b/docs/teaching/exercises/tests/Test2e.java @@ -1,13 +1,13 @@ /* ******************************************************************* * 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 + * 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; @@ -35,7 +35,7 @@ public class Test2e extends Test { try { sq.getP0().setX(100); - sq.move(37, 1); + sq.move(37, 1); fail("should have thrown IllegalStateException"); } catch (IllegalStateException e) { } } diff --git a/docs/teaching/exercises/tests/Test2f.java b/docs/teaching/exercises/tests/Test2f.java index da63b12e1..a11e16781 100644 --- a/docs/teaching/exercises/tests/Test2f.java +++ b/docs/teaching/exercises/tests/Test2f.java @@ -1,13 +1,13 @@ /* ******************************************************************* * 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 + * 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; diff --git a/docs/teaching/exercises/tests/Test2g.java b/docs/teaching/exercises/tests/Test2g.java index 7ed9ba341..f4a7a1949 100644 --- a/docs/teaching/exercises/tests/Test2g.java +++ b/docs/teaching/exercises/tests/Test2g.java @@ -1,13 +1,13 @@ /* ******************************************************************* * 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 + * 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; diff --git a/docs/teaching/exercises/tests/Test2h.java b/docs/teaching/exercises/tests/Test2h.java index 9ed695d9b..339322519 100644 --- a/docs/teaching/exercises/tests/Test2h.java +++ b/docs/teaching/exercises/tests/Test2h.java @@ -1,13 +1,13 @@ /* ******************************************************************* * 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 + * 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; diff --git a/docs/teaching/exercises/tests/Test3a.java b/docs/teaching/exercises/tests/Test3a.java index 3cb063251..33afa3a82 100644 --- a/docs/teaching/exercises/tests/Test3a.java +++ b/docs/teaching/exercises/tests/Test3a.java @@ -1,13 +1,13 @@ /* ******************************************************************* * 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 + * 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; @@ -34,7 +34,7 @@ public class Test3a extends Test { } public void testMovePointLog() { - p1.move(20, 30); + p1.move(20, 30); assertEquals("moving;", Log.getString()); } @@ -43,7 +43,7 @@ public class Test3a extends Test { } public void testGetYPointLog() { - p1.getY(); + p1.getY(); assertEquals("", Log.getString()); } } diff --git a/docs/teaching/exercises/tests/Test3b.java b/docs/teaching/exercises/tests/Test3b.java index 6ec933cee..1e8e8bd4d 100644 --- a/docs/teaching/exercises/tests/Test3b.java +++ b/docs/teaching/exercises/tests/Test3b.java @@ -1,13 +1,13 @@ /* ******************************************************************* * 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 + * 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; @@ -34,21 +34,21 @@ public class Test3b extends Test { } public void testCreateWithPointLog() { - g = new Group(p1); + g = new Group(p1); assertEquals("adding Point;", Log.getString()); } public void testCreateWithoutPointLog() { - g = new Group(l1); + g = new Group(l1); assertEquals("", Log.getString()); } public void testAddPointLog() { - g.add(p1); + g.add(p1); assertEquals("adding Point;", Log.getString()); } public void testAddNonPointLog() { - g.add(l1); + g.add(l1); assertEquals("", Log.getString()); } } diff --git a/docs/teaching/exercises/tests/Test3c.java b/docs/teaching/exercises/tests/Test3c.java index 6c135e91c..292a0213d 100644 --- a/docs/teaching/exercises/tests/Test3c.java +++ b/docs/teaching/exercises/tests/Test3c.java @@ -1,13 +1,13 @@ /* ******************************************************************* * 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 + * 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; @@ -34,14 +34,14 @@ public class Test3c extends Test { } public void testMoveLonePoint() { - p1 = new Point(0, 0); - p1.move(37, 88); + 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); + g = new Group(p1); + p1.move(0, 0); assertEquals("moving as a part of " + g + ";", Log.getString()); } } diff --git a/docs/teaching/exercises/tests/Test4a.java b/docs/teaching/exercises/tests/Test4a.java index ddb18415a..7e8f0f234 100644 --- a/docs/teaching/exercises/tests/Test4a.java +++ b/docs/teaching/exercises/tests/Test4a.java @@ -1,13 +1,13 @@ /* ******************************************************************* * 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 + * 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; @@ -19,8 +19,8 @@ import junit.framework.*; public class Test4a extends Test { Rectangle wholeCanvas = - new Rectangle(FigureElement.MIN_VALUE, FigureElement.MIN_VALUE, - FigureElement.MAX_VALUE, FigureElement.MAX_VALUE); + new Rectangle(FigureElement.MIN_VALUE, FigureElement.MIN_VALUE, + FigureElement.MAX_VALUE, FigureElement.MAX_VALUE); public Test4a(String name) { super(name); } diff --git a/docs/teaching/exercises/tests/Test4b.java b/docs/teaching/exercises/tests/Test4b.java index 609289508..31bea5209 100644 --- a/docs/teaching/exercises/tests/Test4b.java +++ b/docs/teaching/exercises/tests/Test4b.java @@ -1,13 +1,13 @@ /* ******************************************************************* * 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 + * 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; @@ -30,30 +30,30 @@ public class Test4b extends Test { } public void testBasicEquality() { - assertTrue(g.getBounds() == g.getBounds()); + assertTrue(g.getBounds() == g.getBounds()); } public void testEqualityAfterAddition() { - Point p0 = new Point(1, 2); - Point p1 = new Point(2, 3); - - Group g0 = new Group(p0); - Group g1 = new Group(p1); - - Rectangle r0 = g0.getBounds(); - Rectangle r1 = g1.getBounds(); - assertTrue(r0 != r1); - g0.add(new Point(37, 90)); - assertTrue(g0.getBounds() == r0); - assertTrue(g1.getBounds() != r0); - assertTrue(g0.getBounds() != r1); - assertTrue(g1.getBounds() == r1); - - g1.add(new Point(4, 8)); - assertTrue(g0.getBounds() == r0); - assertTrue(g1.getBounds() != r0); - assertTrue(g0.getBounds() != r1); - assertTrue(g1.getBounds() == r1); + Point p0 = new Point(1, 2); + Point p1 = new Point(2, 3); + + Group g0 = new Group(p0); + Group g1 = new Group(p1); + + Rectangle r0 = g0.getBounds(); + Rectangle r1 = g1.getBounds(); + assertTrue(r0 != r1); + g0.add(new Point(37, 90)); + assertTrue(g0.getBounds() == r0); + assertTrue(g1.getBounds() != r0); + assertTrue(g0.getBounds() != r1); + assertTrue(g1.getBounds() == r1); + + g1.add(new Point(4, 8)); + assertTrue(g0.getBounds() == r0); + assertTrue(g1.getBounds() != r0); + assertTrue(g0.getBounds() != r1); + assertTrue(g1.getBounds() == r1); } public void testNotWholeCanvas() { diff --git a/docs/teaching/exercises/tests/Test4c.java b/docs/teaching/exercises/tests/Test4c.java index b5bf8f708..1f30a9ae3 100644 --- a/docs/teaching/exercises/tests/Test4c.java +++ b/docs/teaching/exercises/tests/Test4c.java @@ -1,13 +1,13 @@ /* ******************************************************************* * 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 + * 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; @@ -30,54 +30,54 @@ public class Test4c extends Test { } public void testBasicEquality() { - assertTrue(g.getBounds() == g.getBounds()); + assertTrue(g.getBounds() == g.getBounds()); } public void testEqualityAfterAddition() { - Point p0 = new Point(1, 2); - Point p1 = new Point(2, 3); - - Group g0 = new Group(p0); - Group g1 = new Group(p1); - - Rectangle r0 = g0.getBounds(); - Rectangle r1 = g1.getBounds(); - assertTrue(r0 != r1); - g0.add(new Point(37, 90)); - assertTrue(g0.getBounds() == r0); - assertTrue(g1.getBounds() != r0); - assertTrue(g0.getBounds() != r1); - assertTrue(g1.getBounds() == r1); - - g1.add(new Point(4, 8)); - assertTrue(g0.getBounds() == r0); - assertTrue(g1.getBounds() != r0); - assertTrue(g0.getBounds() != r1); - assertTrue(g1.getBounds() == r1); + Point p0 = new Point(1, 2); + Point p1 = new Point(2, 3); + + Group g0 = new Group(p0); + Group g1 = new Group(p1); + + Rectangle r0 = g0.getBounds(); + Rectangle r1 = g1.getBounds(); + assertTrue(r0 != r1); + g0.add(new Point(37, 90)); + assertTrue(g0.getBounds() == r0); + assertTrue(g1.getBounds() != r0); + assertTrue(g0.getBounds() != r1); + assertTrue(g1.getBounds() == r1); + + g1.add(new Point(4, 8)); + assertTrue(g0.getBounds() == r0); + assertTrue(g1.getBounds() != r0); + assertTrue(g0.getBounds() != r1); + assertTrue(g1.getBounds() == r1); } public void testEqualityAfterMove() { - Point p0 = new Point(1, 2); - Point p1 = new Point(2, 3); - - Group g0 = new Group(p0); - Group g1 = new Group(p1); - - Rectangle r0 = g0.getBounds(); - Rectangle r1 = g1.getBounds(); - assertTrue(r0 != r1); - assertTrue(g0.getBounds() == r0); - assertTrue(g1.getBounds() != r0); - assertTrue(g0.getBounds() != r1); - assertTrue(g1.getBounds() == r1); - - g0.move(3, 1); - Rectangle r00 = g0.getBounds(); - Rectangle r10 = g1.getBounds(); - - assertTrue(r10 != r00); - assertTrue(r0 != r00); - assertTrue(g0.getBounds() == r00); + Point p0 = new Point(1, 2); + Point p1 = new Point(2, 3); + + Group g0 = new Group(p0); + Group g1 = new Group(p1); + + Rectangle r0 = g0.getBounds(); + Rectangle r1 = g1.getBounds(); + assertTrue(r0 != r1); + assertTrue(g0.getBounds() == r0); + assertTrue(g1.getBounds() != r0); + assertTrue(g0.getBounds() != r1); + assertTrue(g1.getBounds() == r1); + + g0.move(3, 1); + Rectangle r00 = g0.getBounds(); + Rectangle r10 = g1.getBounds(); + + assertTrue(r10 != r00); + assertTrue(r0 != r00); + assertTrue(g0.getBounds() == r00); } } diff --git a/docs/teaching/exercises/tests/Test4d.java b/docs/teaching/exercises/tests/Test4d.java index e4458c6a4..c1871cfd0 100644 --- a/docs/teaching/exercises/tests/Test4d.java +++ b/docs/teaching/exercises/tests/Test4d.java @@ -1,13 +1,13 @@ /* ******************************************************************* * 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 + * 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; @@ -30,51 +30,51 @@ public class Test4d extends Test { } public void testBasicEquality() { - assertTrue(g.getBounds() == g.getBounds()); + assertTrue(g.getBounds() == g.getBounds()); } public void testNonGroupMove() { - p1.move(3, 27); + p1.move(3, 27); } public void testEqualityAfterAddition() { - Rectangle r = g.getBounds(); - g.add(new Point(37, 90)); - assertTrue(g.getBounds() == r); + Rectangle r = g.getBounds(); + g.add(new Point(37, 90)); + assertTrue(g.getBounds() == r); } public void testEqualityAfterMove() { - Point p0 = new Point(1, 2); - Point p1 = new Point(2, 3); - - Group g0 = new Group(p0); - Group g1 = new Group(p1); - - Rectangle r0 = g0.getBounds(); - Rectangle r1 = g1.getBounds(); - assertTrue(r0 != r1); - assertTrue(g0.getBounds() == r0); - assertTrue(g1.getBounds() != r0); - assertTrue(g0.getBounds() != r1); - assertTrue(g1.getBounds() == r1); - - p0.move(3, 1); - Rectangle r00 = g0.getBounds(); - Rectangle r10 = g1.getBounds(); - - assertTrue(r10 != r00); - assertTrue(r0 != r00); - assertTrue(g0.getBounds() == r00); + Point p0 = new Point(1, 2); + Point p1 = new Point(2, 3); + + Group g0 = new Group(p0); + Group g1 = new Group(p1); + + Rectangle r0 = g0.getBounds(); + Rectangle r1 = g1.getBounds(); + assertTrue(r0 != r1); + assertTrue(g0.getBounds() == r0); + assertTrue(g1.getBounds() != r0); + assertTrue(g0.getBounds() != r1); + assertTrue(g1.getBounds() == r1); + + p0.move(3, 1); + Rectangle r00 = g0.getBounds(); + Rectangle r10 = g1.getBounds(); + + assertTrue(r10 != r00); + assertTrue(r0 != r00); + assertTrue(g0.getBounds() == r00); } public void testEqualityAfterMove0() { - g = new Group(p1); - Rectangle r0 = g.getBounds(); - assertTrue(g.getBounds() == r0); - p1.move(3, 1); - Rectangle r1 = g.getBounds(); - assertTrue(r0 != r1); - assertTrue(r1 == g.getBounds()); + g = new Group(p1); + Rectangle r0 = g.getBounds(); + assertTrue(g.getBounds() == r0); + p1.move(3, 1); + Rectangle r1 = g.getBounds(); + assertTrue(r0 != r1); + assertTrue(r1 == g.getBounds()); } } diff --git a/docs/teaching/exercises/tests/Test4e.java b/docs/teaching/exercises/tests/Test4e.java index f6a3635d2..91710b0ea 100644 --- a/docs/teaching/exercises/tests/Test4e.java +++ b/docs/teaching/exercises/tests/Test4e.java @@ -1,13 +1,13 @@ /* ******************************************************************* * 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 + * 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; @@ -30,38 +30,38 @@ public class Test4e extends Test { } public void testBasicEquality() { - assertTrue(g.getBounds() == g.getBounds()); + assertTrue(g.getBounds() == g.getBounds()); } public void testNonGroupMove() { - p1.move(3, 27); + p1.move(3, 27); } public void testEqualityAfterAddition() { - Rectangle r = g.getBounds(); - g.add(new Point(37, 90)); - assertTrue(g.getBounds() == r); + Rectangle r = g.getBounds(); + g.add(new Point(37, 90)); + assertTrue(g.getBounds() == r); } public void testEqualityAfterMove() { - g = new Group(p1); - Rectangle r0 = g.getBounds(); - assertTrue(g.getBounds() == r0); - p1.move(3, 1); - Rectangle r1 = g.getBounds(); - assertTrue(r0 != r1); - assertTrue(r1 == g.getBounds()); + g = new Group(p1); + Rectangle r0 = g.getBounds(); + assertTrue(g.getBounds() == r0); + p1.move(3, 1); + Rectangle r1 = g.getBounds(); + assertTrue(r0 != r1); + assertTrue(r1 == g.getBounds()); } public void testSecondEnclosingGroup() { - g = new Group(p1); - Group h = new Group(g); - Rectangle r0 = h.getBounds(); - assertTrue(h.getBounds() == r0); - p1.move(3, 1); - Rectangle r1 = h.getBounds(); - assertTrue(r0 != r1); - assertTrue(r1 == h.getBounds()); + g = new Group(p1); + Group h = new Group(g); + Rectangle r0 = h.getBounds(); + assertTrue(h.getBounds() == r0); + p1.move(3, 1); + Rectangle r1 = h.getBounds(); + assertTrue(r0 != r1); + assertTrue(r1 == h.getBounds()); } } |