summaryrefslogtreecommitdiffstats
path: root/test/jrummikub/control/turn
diff options
context:
space:
mode:
Diffstat (limited to 'test/jrummikub/control/turn')
-rw-r--r--test/jrummikub/control/turn/TurnControlTest.java77
1 files changed, 42 insertions, 35 deletions
diff --git a/test/jrummikub/control/turn/TurnControlTest.java b/test/jrummikub/control/turn/TurnControlTest.java
index 150f3e9..9140323 100644
--- a/test/jrummikub/control/turn/TurnControlTest.java
+++ b/test/jrummikub/control/turn/TurnControlTest.java
@@ -105,7 +105,8 @@ public class TurnControlTest {
mockTimer = new MockTimer();
mockTable = new MockTable();
mockHand = new MockHand();
- testControl = new HumanTurnControl(mockHand, mockTable, mockView, mockTimer);
+ testControl = new HumanTurnControl(mockTimer);
+ testControl.setup(mockHand, mockTable, mockView, false, false);
}
/** */
@@ -122,14 +123,15 @@ public class TurnControlTest {
public void showInitialHand() {
mockView.displayStartTurnPanel = true;
- List<Pair<Stone, Position>> stones = Arrays.asList(
- new Pair<Stone, Position>(new Stone(RED), new Position(0, 0)),
- new Pair<Stone, Position>(new Stone(BLACK), new Position(1, 0)));
+ List<Pair<Stone, Position>> stones = Arrays
+ .asList(new Pair<Stone, Position>(new Stone(RED), new Position(
+ 0, 0)), new Pair<Stone, Position>(new Stone(BLACK),
+ new Position(1, 0)));
mockHand.iterable = stones;
- testControl = new HumanTurnControl(mockHand, mockTable, mockView, mockTimer);
-
+ testControl = new HumanTurnControl(mockTimer);
+ testControl.setup(mockHand, mockTable, mockView, false, false);
testControl.startTurn();
int i = 0;
@@ -256,8 +258,8 @@ public class TurnControlTest {
mockView.handPanel.stoneClickEvent.emit(firstStone, true);
mockView.handPanel.stoneClickEvent.emit(secondStone, true);
- mockView.tablePanel.stoneCollectionPanel.stoneClickEvent.emit(firstStone,
- false);
+ mockView.tablePanel.stoneCollectionPanel.stoneClickEvent.emit(
+ firstStone, false);
assertCollection(Arrays.asList(secondStone));
}
@@ -273,8 +275,8 @@ public class TurnControlTest {
mockView.handPanel.stoneClickEvent.emit(firstStone, true);
mockView.handPanel.stoneClickEvent.emit(secondStone, true);
- mockView.tablePanel.stoneCollectionPanel.stoneClickEvent.emit(firstStone,
- true);
+ mockView.tablePanel.stoneCollectionPanel.stoneClickEvent.emit(
+ firstStone, true);
assertCollection(Arrays.asList(secondStone, firstStone));
}
@@ -290,8 +292,8 @@ public class TurnControlTest {
mockView.handPanel.stoneClickEvent.emit(firstStone, true);
mockView.handPanel.stoneClickEvent.emit(secondStone, true);
- mockView.tablePanel.stoneCollectionPanel.stoneClickEvent.emit(firstStone,
- true);
+ mockView.tablePanel.stoneCollectionPanel.stoneClickEvent.emit(
+ firstStone, true);
mockView.tablePanel.stoneCollectionPanel.setClickEvent.emit(firstStone,
true);
@@ -398,7 +400,8 @@ public class TurnControlTest {
Stone stone2 = new Stone(2, StoneColor.RED);
Stone stone3 = new Stone(3, StoneColor.RED);
Stone stone4 = new Stone(4, StoneColor.RED);
- StoneSet set1 = new StoneSet(Arrays.asList(stone1, stone2, stone3, stone4));
+ StoneSet set1 = new StoneSet(Arrays.asList(stone1, stone2, stone3,
+ stone4));
mockTable.findStoneSet.put(stone1, set1);
mockTable.findStoneSet.put(stone3, set1);
@@ -419,7 +422,8 @@ public class TurnControlTest {
Stone stone2 = new Stone(2, StoneColor.RED);
Stone stone3 = new Stone(3, StoneColor.RED);
Stone stone4 = new Stone(4, StoneColor.RED);
- StoneSet set1 = new StoneSet(Arrays.asList(stone1, stone2, stone3, stone4));
+ StoneSet set1 = new StoneSet(Arrays.asList(stone1, stone2, stone3,
+ stone4));
mockTable.findStoneSet.put(stone1, set1);
mockTable.findStoneSet.put(stone3, set1);
@@ -442,7 +446,8 @@ public class TurnControlTest {
Stone stone2 = new Stone(2, StoneColor.RED);
Stone stone3 = new Stone(3, StoneColor.RED);
Stone stone4 = new Stone(4, StoneColor.RED);
- StoneSet set1 = new StoneSet(Arrays.asList(stone1, stone2, stone3, stone4));
+ StoneSet set1 = new StoneSet(Arrays.asList(stone1, stone2, stone3,
+ stone4));
mockTable.findStoneSet.put(stone1, set1);
mockTable.findStoneSet.put(stone3, set1);
@@ -621,8 +626,8 @@ public class TurnControlTest {
@Test
public void testAddLeft() {
AccessibleTable table = new AccessibleTable();
- HumanTurnControl turnControl = new HumanTurnControl(mockHand, table, mockView,
- mockTimer);
+ HumanTurnControl turnControl = new HumanTurnControl(mockTimer);
+ turnControl.setup(mockHand, table, mockView, false, false);
turnControl.startTurn();
Stone blueOne = new Stone(1, BLUE);
Stone redOne = new Stone(1, RED);
@@ -637,10 +642,10 @@ public class TurnControlTest {
Stone blackThree = new Stone(3, BLACK);
Stone blackFour = new Stone(4, BLACK);
Stone blackFive = new Stone(5, BLACK);
- StoneSet oldSet1 = new StoneSet(Arrays.asList(blueOne, redOne, blackOne,
- redTwo, redThree, redFour, blackTwo, blackThree));
- StoneSet oldSet2 = new StoneSet(
- Arrays.asList(blueTwo, blackFour, blackFive));
+ StoneSet oldSet1 = new StoneSet(Arrays.asList(blueOne, redOne,
+ blackOne, redTwo, redThree, redFour, blackTwo, blackThree));
+ StoneSet oldSet2 = new StoneSet(Arrays.asList(blueTwo, blackFour,
+ blackFive));
table.drop(oldSet1, new Position(0, 0));
table.drop(oldSet2, new Position(0, 0));
mockHand.drop(blueThree, new Position(0, 0));
@@ -738,8 +743,8 @@ public class TurnControlTest {
@Test
public void testAddRight() {
AccessibleTable table = new AccessibleTable();
- HumanTurnControl turnControl = new HumanTurnControl(mockHand, table, mockView,
- mockTimer);
+ HumanTurnControl turnControl = new HumanTurnControl(mockTimer);
+ turnControl.setup(mockHand, table, mockView, false, false);
turnControl.startTurn();
Stone blueOne = new Stone(1, BLUE);
Stone redOne = new Stone(1, RED);
@@ -754,10 +759,10 @@ public class TurnControlTest {
Stone blackThree = new Stone(3, BLACK);
Stone blackFour = new Stone(4, BLACK);
Stone blackFive = new Stone(5, BLACK);
- StoneSet oldSet1 = new StoneSet(Arrays.asList(blueOne, redOne, blackOne,
- redTwo, redThree, redFour, blackTwo, blackThree));
- StoneSet oldSet2 = new StoneSet(
- Arrays.asList(blueTwo, blackFour, blackFive));
+ StoneSet oldSet1 = new StoneSet(Arrays.asList(blueOne, redOne,
+ blackOne, redTwo, redThree, redFour, blackTwo, blackThree));
+ StoneSet oldSet2 = new StoneSet(Arrays.asList(blueTwo, blackFour,
+ blackFive));
table.drop(oldSet1, new Position(0, 0));
table.drop(oldSet2, new Position(0, 0));
mockHand.drop(blueThree, new Position(0, 0));
@@ -855,8 +860,8 @@ public class TurnControlTest {
@Test
public void testAddNewSet() {
AccessibleTable table = new AccessibleTable();
- HumanTurnControl turnControl = new HumanTurnControl(mockHand, table, mockView,
- mockTimer);
+ HumanTurnControl turnControl = new HumanTurnControl(mockTimer);
+ turnControl.setup(mockHand, table, mockView, false, false);
turnControl.startTurn();
Stone blueOne = new Stone(1, BLUE);
Stone redOne = new Stone(1, RED);
@@ -871,10 +876,10 @@ public class TurnControlTest {
Stone blackThree = new Stone(3, BLACK);
Stone blackFour = new Stone(4, BLACK);
Stone blackFive = new Stone(5, BLACK);
- StoneSet oldSet1 = new StoneSet(Arrays.asList(blueOne, redOne, blackOne,
- redTwo, redThree, redFour, blackTwo, blackThree));
- StoneSet oldSet2 = new StoneSet(
- Arrays.asList(blueTwo, blackFour, blackFive));
+ StoneSet oldSet1 = new StoneSet(Arrays.asList(blueOne, redOne,
+ blackOne, redTwo, redThree, redFour, blackTwo, blackThree));
+ StoneSet oldSet2 = new StoneSet(Arrays.asList(blueTwo, blackFour,
+ blackFive));
table.drop(oldSet1, new Position(0, 0));
table.drop(oldSet2, new Position(0, 0));
mockHand.drop(blueThree, new Position(0, 0));
@@ -978,7 +983,8 @@ public class TurnControlTest {
List<Pair<Stone, Position>> stones = new ArrayList<Pair<Stone, Position>>(
mockHand.stones);
- Collections.sort(stones, new HumanTurnControl.HandStonePositionComparator());
+ Collections.sort(stones,
+ new HumanTurnControl.HandStonePositionComparator());
assertEquals(stones.size(), 13);
@@ -1039,7 +1045,8 @@ public class TurnControlTest {
List<Pair<Stone, Position>> stones = new ArrayList<Pair<Stone, Position>>(
mockHand.stones);
- Collections.sort(stones, new HumanTurnControl.HandStonePositionComparator());
+ Collections.sort(stones,
+ new HumanTurnControl.HandStonePositionComparator());
assertEquals(stones.size(), 13);