From bc827302d0753a67774fd625d0c90eba7d83094f Mon Sep 17 00:00:00 2001 From: Bennet Gerlach Date: Thu, 5 May 2011 00:19:02 +0200 Subject: Show initial hand succeeds git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@136 72836036-5685-4462-b002-a69064685172 --- test/jrummikub/control/TurnControlTest.java | 28 ++++++++++++++-------------- test/jrummikub/model/MockHand.java | 8 ++++++-- 2 files changed, 20 insertions(+), 16 deletions(-) (limited to 'test') diff --git a/test/jrummikub/control/TurnControlTest.java b/test/jrummikub/control/TurnControlTest.java index 2efab67..2cca3e8 100644 --- a/test/jrummikub/control/TurnControlTest.java +++ b/test/jrummikub/control/TurnControlTest.java @@ -59,14 +59,14 @@ public class TurnControlTest { mockTimer = new MockTimer(); mockTable = new MockTable(); mockHand = new MockHand(); - testControl = new TurnControl(null, mockTable, mockView, mockTimer); + testControl = new TurnControl(mockHand, mockTable, mockView, mockTimer); } @Test public void startTimer() { assertTrue(mockTimer.timerRunning); } - + @SuppressWarnings("unchecked") @Test public void showInitialHand() { @@ -74,25 +74,25 @@ public class TurnControlTest { mockTimer = new MockTimer(); mockTable = new MockTable(); mockHand = new MockHand(); - - - mockView.displayStartTurnPanel = false; - - List> stones = Arrays.asList(new Pair(new Stone(RED), new Position(0,0)), - new Pair(new Stone(BLACK), new Position(1,0))); - + + mockView.displayStartTurnPanel = true; + + List> stones = Arrays.asList( + new Pair(new Stone(RED), new Position(0, 0)), + new Pair(new Stone(BLACK), new Position(1, 0))); + mockHand.iterable = stones; - - testControl = new TurnControl(null, mockTable, mockView, mockTimer); - + + testControl = new TurnControl(mockHand, mockTable, mockView, mockTimer); + int i = 0; for (Pair pair : mockView.playerPanel.handPanel.stones) { assertSame(stones.get(i), pair); i++; } assertEquals(stones.size(), i); - - assertTrue(mockView.displayStartTurnPanel); + + assertFalse(mockView.displayStartTurnPanel); } @Test diff --git a/test/jrummikub/model/MockHand.java b/test/jrummikub/model/MockHand.java index 0d0c523..2132ff4 100644 --- a/test/jrummikub/model/MockHand.java +++ b/test/jrummikub/model/MockHand.java @@ -9,7 +9,7 @@ import jrummikub.util.Pair; public class MockHand implements IHand { public List stones = new ArrayList(); - + public Iterable> iterable; @Override @@ -45,6 +45,10 @@ public class MockHand implements IHand { } public MockHand clone() { - return null; + try { + return (MockHand) super.clone(); + } catch (CloneNotSupportedException e) { + return null; + } } } -- cgit v1.2.3