From 88292e9304afd644db9f54a526ecbe9bae314dd6 Mon Sep 17 00:00:00 2001 From: Jannis Harder Date: Tue, 3 May 2011 19:06:12 +0200 Subject: tested and implemented clone() in StoneTray git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@84 72836036-5685-4462-b002-a69064685172 --- test/jrummikub/model/StoneTrayTest.java | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test') diff --git a/test/jrummikub/model/StoneTrayTest.java b/test/jrummikub/model/StoneTrayTest.java index 23d9ea0..3456229 100644 --- a/test/jrummikub/model/StoneTrayTest.java +++ b/test/jrummikub/model/StoneTrayTest.java @@ -150,6 +150,7 @@ public class StoneTrayTest { for (Pair i : testTray) { assertSame(i.getFirst(), secondThing); } + assertTrue(testTray.iterator().hasNext()); } @Test @@ -185,4 +186,26 @@ public class StoneTrayTest { assertTrue(testThings.isEmpty()); assertTrue(testPositions.isEmpty()); } + + @Test + public void testClone() { + Thing firstThing = new Thing(5, 5); + testTray.drop(firstThing, new Position(0, 0)); + Thing secondThing = new Thing(3, 3); + testTray.drop(secondThing, new Position(-5, -5)); + StoneTray trayCopy = testTray.clone(); + + + testTray.pickUp(firstThing); + for (Pair i : testTray) { + assertSame(i.getFirst(), secondThing); + } + assertTrue(testTray.iterator().hasNext()); + + trayCopy.pickUp(secondThing); + for (Pair i : trayCopy) { + assertSame(i.getFirst(), firstThing); + } + assertTrue(trayCopy.iterator().hasNext()); + } } -- cgit v1.2.3