diff options
Diffstat (limited to 'test/jrummikub/control/RoundControlTest.java')
-rw-r--r-- | test/jrummikub/control/RoundControlTest.java | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/test/jrummikub/control/RoundControlTest.java b/test/jrummikub/control/RoundControlTest.java index a6279ba..6b4cb23 100644 --- a/test/jrummikub/control/RoundControlTest.java +++ b/test/jrummikub/control/RoundControlTest.java @@ -6,6 +6,7 @@ import static org.junit.Assert.*; import java.awt.Color; import java.util.Arrays; import java.util.Iterator; +import java.util.List; import jrummikub.control.turn.TurnMode; import jrummikub.model.GameSettings; @@ -223,12 +224,8 @@ public class RoundControlTest { } IHand hand = roundState.getActivePlayer().getHand(); - hand.drop(blueOne, new Position(0, 0)); - hand.drop(blueTwo, new Position(0, 0)); - hand.drop(blueThree, new Position(0, 0)); - hand.drop(blueTen, new Position(0, 0)); - hand.drop(redTen, new Position(0, 0)); - hand.drop(blueEleven, new Position(0, 0)); + dropStonesOnHand(hand, Arrays.asList(blueOne, blueTwo, blueThree, + blueTen, redTen, blueEleven)); view.startTurnEvent.emit(); view.handPanel.stoneClickEvent.emit(blueOne, false); @@ -255,6 +252,12 @@ public class RoundControlTest { .getSize()); } + private void dropStonesOnHand(IHand hand, List<Stone> stones) { + for (int i = 0; i < stones.size(); i++) { + hand.drop(stones.get(i), new Position(0, 0)); + } + } + /** Threshold=30 */ @Test public void laidOutTooFewChangedTable() { @@ -265,14 +268,8 @@ public class RoundControlTest { } // Fake Turn to put stones on the table IHand hand = roundState.getActivePlayer().getHand(); - hand.drop(blueOne, new Position(0, 0)); - hand.drop(blueTwo, new Position(0, 0)); - hand.drop(blueThree, new Position(0, 0)); - - hand.drop(redSeven, new Position(0, 0)); - hand.drop(blueSeven, new Position(0, 0)); - hand.drop(blackSeven, new Position(0, 0)); - hand.drop(orangeSeven, new Position(0, 0)); + dropStonesOnHand(hand, Arrays.asList(blueOne, blueTwo, blueThree, + blueSeven, redSeven, blackSeven, orangeSeven)); view.startTurnEvent.emit(); view.handPanel.stoneClickEvent.emit(redSeven, false); @@ -292,6 +289,7 @@ public class RoundControlTest { assertEquals(2, roundState.getTable().getSize()); hand = roundState.getActivePlayer().getHand(); + dropStonesOnHand(hand, Arrays.asList(redEight, redNine, redTen)); hand.drop(redEight, new Position(0, 0)); hand.drop(redNine, new Position(0, 0)); hand.drop(redTen, new Position(0, 0)); @@ -324,14 +322,8 @@ public class RoundControlTest { } // Fake Turn to put stones on the table IHand hand = roundState.getActivePlayer().getHand(); - hand.drop(blueOne, new Position(0, 0)); - hand.drop(blueTwo, new Position(0, 0)); - hand.drop(blueThree, new Position(0, 0)); - - hand.drop(redSeven, new Position(0, 0)); - hand.drop(blueSeven, new Position(0, 0)); - hand.drop(blackSeven, new Position(0, 0)); - hand.drop(orangeSeven, new Position(0, 0)); + dropStonesOnHand(hand, Arrays.asList(blueOne, blueTwo, blueThree, + blueSeven, redSeven, blackSeven, orangeSeven)); view.startTurnEvent.emit(); view.handPanel.stoneClickEvent.emit(redSeven, false); @@ -351,10 +343,8 @@ public class RoundControlTest { assertEquals(2, roundState.getTable().getSize()); hand = roundState.getActivePlayer().getHand(); - hand.drop(redEight, new Position(0, 0)); - hand.drop(redNine, new Position(0, 0)); - hand.drop(redTen, new Position(0, 0)); - hand.drop(redEleven, new Position(0, 0)); + dropStonesOnHand(hand, + Arrays.asList(redEight, redNine, redTen, redEleven)); view.startTurnEvent.emit(); view.tablePanel.stoneClickEvent.emit(redSeven, false); |