This repository has been archived on 2025-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
JRummikub/test/jrummikub/control/RoundControlTest.java
Jannis Harder 4a98975b0d Calculate points on hand
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@264 72836036-5685-4462-b002-a69064685172
2011-05-24 01:51:56 +02:00

704 lines
22 KiB
Java

package jrummikub.control;
import static jrummikub.model.StoneColor.BLACK;
import static jrummikub.model.StoneColor.BLUE;
import static jrummikub.model.StoneColor.ORANGE;
import static jrummikub.model.StoneColor.RED;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import java.awt.Color;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import jrummikub.model.GameSettings;
import jrummikub.model.Hand;
import jrummikub.model.IHand;
import jrummikub.model.IPlayer;
import jrummikub.model.IRoundState;
import jrummikub.model.ITable;
import jrummikub.model.MockRoundState;
import jrummikub.model.MockTable;
import jrummikub.model.PlayerSettings;
import jrummikub.model.Position;
import jrummikub.model.RoundState;
import jrummikub.model.Stone;
import jrummikub.model.StoneSet;
import jrummikub.model.Table;
import jrummikub.util.Pair;
import jrummikub.view.MockView;
import org.junit.Before;
import org.junit.Test;
/**
* Tests for {@link RoundControl}
*/
public class RoundControlTest {
private MockView view;
private MockRoundState testRoundState;
private RoundControl testRound;
private MockTable testTable;
private GameSettings gameSettings;
private IRoundState roundState;
private RoundControl roundControl;
/**
* For each test create a round control initialized by a mock model and view
*/
@Before
public void setup() {
view = new MockView();
testRoundState = new MockRoundState();
testRound = new RoundControl(testRoundState, view);
Stone stone = testRoundState.getGameHeap().drawStone();
testRoundState.table.drop(new StoneSet(stone), new Position(5, 0));
testTable = new MockTable();
testTable.sets.add(testRoundState.table.sets.get(0));
testRoundState.table.clonedTable = testTable;
gameSettings = new GameSettings();
gameSettings.getPlayerList().add(new PlayerSettings("Ida", Color.RED));
gameSettings.getPlayerList().add(
new PlayerSettings("Matthias", Color.YELLOW));
gameSettings.getPlayerList().add(
new PlayerSettings("Jannis", Color.GREEN));
gameSettings.getPlayerList().add(
new PlayerSettings("Bennet", Color.BLACK));
roundState = new RoundState(gameSettings);
roundControl = new RoundControl(roundState, view);
}
private void checkCorrectlyDealed() {
assertEquals(106 - testRoundState.getPlayerCount() * 14
- testRoundState.table.getSize(), testRoundState.getGameHeap()
.getSize());
for (int i = 0; i < testRoundState.getPlayerCount(); i++) {
assertEquals(14, testRoundState.getNthNextPlayer(i).getHand()
.getSize());
}
}
private void checkTurnStartSetUp() {
assertNotNull(view.currentPlayerName);
assertNotNull(view.getTablePanel().leftPlayerName);
assertNotNull(view.getTablePanel().topPlayerName);
assertNotNull(view.getTablePanel().rightPlayerName);
assertTrue(view.displayStartTurnPanel);
assertFalse(view.startTurnEvent.listeners.isEmpty());
assertFalse(view.displayWinPanel);
checkTableDisplay();
}
private void checkTableDisplay() {
Iterator<Pair<StoneSet, Position>> stoneSetsView = view.tablePanel.stoneSets
.iterator();
Iterator<Pair<StoneSet, Position>> stoneSetsModel = testRoundState.table
.clone().sets.iterator();
while (stoneSetsView.hasNext()) {
assertTrue(stoneSetsModel.hasNext());
assertSame(stoneSetsView.next(), stoneSetsModel.next());
}
assertFalse(stoneSetsModel.hasNext());
}
private void resetTurnStart() {
view.currentPlayerName = null;
view.getTablePanel().leftPlayerName = null;
view.getTablePanel().topPlayerName = null;
view.getTablePanel().rightPlayerName = null;
view.displayStartTurnPanel = false;
}
// laidOut test cases
/** Threshold=30 */
@Test
public void laidOutValidTooFew() {
roundControl.startRound();
view.startTurnEvent.emit();
Stone blueOne = new Stone(1, BLUE);
Stone blueTwo = new Stone(2, BLUE);
Stone blueThree = new Stone(3, BLUE);
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));
assertFalse(roundState.getActivePlayer().getLaidOut());
view.handPanel.stoneClickEvent.emit(blueOne, false);
view.handPanel.stoneClickEvent.emit(blueTwo, true);
view.handPanel.stoneClickEvent.emit(blueThree, true);
view.tablePanel.clickEvent.emit(new Position(0, 0));
view.playerPanel.endTurnEvent.emit();
assertFalse(roundState
.getNthNextPlayer(roundState.getPlayerCount() - 1).getLaidOut());
assertEquals(0, roundState.getTable().getSize());
assertEquals(14 + 6, hand.getSize());
}
/** Threshold=30 */
@Test
public void laidOutInvalidEnough() {
roundControl.startRound();
view.startTurnEvent.emit();
Stone blueOne = new Stone(1, BLUE);
Stone blueTwo = new Stone(2, BLUE);
Stone blueThree = new Stone(3, BLUE);
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));
view.handPanel.stoneClickEvent.emit(blueOne, false);
view.handPanel.stoneClickEvent.emit(blueTwo, true);
view.handPanel.stoneClickEvent.emit(blueThree, true);
view.tablePanel.clickEvent.emit(new Position(0, 0));
Stone blueTen = new Stone(10, BLUE);
Stone redTen = new Stone(10, RED);
Stone blueEleven = new Stone(11, BLUE);
assertFalse(roundState.getActivePlayer().getLaidOut());
hand.drop(blueTen, new Position(0, 0));
hand.drop(redTen, new Position(0, 0));
hand.drop(blueEleven, new Position(0, 0));
view.handPanel.stoneClickEvent.emit(blueTen, false);
view.handPanel.stoneClickEvent.emit(redTen, true);
view.handPanel.stoneClickEvent.emit(blueEleven, true);
view.tablePanel.clickEvent.emit(new Position(0, 0));
view.playerPanel.endTurnEvent.emit();
assertFalse(roundState
.getNthNextPlayer(roundState.getPlayerCount() - 1).getLaidOut());
assertEquals(0, roundState.getTable().getSize());
assertEquals(14 + 9, hand.getSize());
}
/** Threshold=30 */
@Test
public void laidOutTooFewChangedTable() {
roundControl.startRound();
view.startTurnEvent.emit();
// Fake Turn to put stones on the table
Stone blueSeven = new Stone(7, BLUE);
Stone blackSeven = new Stone(7, BLACK);
Stone redSeven = new Stone(7, RED);
Stone orangeSeven = new Stone(7, ORANGE);
Stone blueOne = new Stone(1, BLUE);
Stone blueTwo = new Stone(2, BLUE);
Stone blueThree = new Stone(3, BLUE);
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));
view.handPanel.stoneClickEvent.emit(redSeven, false);
view.handPanel.stoneClickEvent.emit(blueSeven, true);
view.handPanel.stoneClickEvent.emit(blackSeven, true);
view.handPanel.stoneClickEvent.emit(orangeSeven, true);
view.tablePanel.clickEvent.emit(new Position(0, 0));
view.handPanel.stoneClickEvent.emit(blueOne, false);
view.handPanel.stoneClickEvent.emit(blueTwo, true);
view.handPanel.stoneClickEvent.emit(blueThree, true);
view.tablePanel.clickEvent.emit(new Position(0, 0));
view.playerPanel.endTurnEvent.emit();
assertEquals(2, roundState.getTable().getSize());
view.startTurnEvent.emit();
Stone redEight = new Stone(8, RED);
Stone redNine = new Stone(9, RED);
Stone redTen = new Stone(10, RED);
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));
view.tablePanel.stoneClickEvent.emit(redSeven, false);
view.handPanel.stoneClickEvent.emit(redEight, true);
view.handPanel.stoneClickEvent.emit(redNine, true);
view.handPanel.stoneClickEvent.emit(redTen, true);
assertFalse(roundState.getActivePlayer().getLaidOut());
view.tablePanel.clickEvent.emit(new Position(0, 0));
view.playerPanel.endTurnEvent.emit();
assertFalse(roundState
.getNthNextPlayer(roundState.getPlayerCount() - 1).getLaidOut());
assertEquals(2, roundState.getTable().getSize());
assertEquals(14 + 6, hand.getSize());
}
/** Threshold=30 */
@Test
public void laidOutEnoughChangedTable() {
roundControl.startRound();
view.startTurnEvent.emit();
// Fake Turn to put stones on the table
Stone blueSeven = new Stone(7, BLUE);
Stone blackSeven = new Stone(7, BLACK);
Stone redSeven = new Stone(7, RED);
Stone orangeSeven = new Stone(7, ORANGE);
Stone blueOne = new Stone(1, BLUE);
Stone blueTwo = new Stone(2, BLUE);
Stone blueThree = new Stone(3, BLUE);
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));
view.handPanel.stoneClickEvent.emit(redSeven, false);
view.handPanel.stoneClickEvent.emit(blueSeven, true);
view.handPanel.stoneClickEvent.emit(blackSeven, true);
view.handPanel.stoneClickEvent.emit(orangeSeven, true);
view.tablePanel.clickEvent.emit(new Position(0, 0));
view.handPanel.stoneClickEvent.emit(blueOne, false);
view.handPanel.stoneClickEvent.emit(blueTwo, true);
view.handPanel.stoneClickEvent.emit(blueThree, true);
view.tablePanel.clickEvent.emit(new Position(0, 0));
view.playerPanel.endTurnEvent.emit();
assertEquals(2, roundState.getTable().getSize());
view.startTurnEvent.emit();
Stone redEight = new Stone(8, RED);
Stone redNine = new Stone(9, RED);
Stone redTen = new Stone(10, RED);
Stone redEleven = new Stone(11, RED);
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));
view.tablePanel.stoneClickEvent.emit(redSeven, false);
view.handPanel.stoneClickEvent.emit(redEight, true);
view.handPanel.stoneClickEvent.emit(redNine, true);
view.handPanel.stoneClickEvent.emit(redTen, true);
view.handPanel.stoneClickEvent.emit(redEleven, true);
assertFalse(roundState.getActivePlayer().getLaidOut());
view.tablePanel.clickEvent.emit(new Position(0, 0));
view.playerPanel.endTurnEvent.emit();
assertFalse(roundState
.getNthNextPlayer(roundState.getPlayerCount() - 1).getLaidOut());
assertEquals(2, roundState.getTable().getSize());
assertEquals(14 + 7, hand.getSize());
}
@Test
public void laidOutJustChangedTable() {
roundControl.startRound();
view.startTurnEvent.emit();
// Fake Turn to put stones on the table
Stone blueFour = new Stone(4, BLUE);
Stone blackFour = new Stone(4, BLACK);
Stone redFour = new Stone(4, RED);
Stone orangeFour = new Stone(4, ORANGE);
Stone blueFive = new Stone(5, BLUE);
Stone blueSix = new Stone(6, BLUE);
Stone blueSeven = new Stone(7, BLUE);
IHand hand = roundState.getActivePlayer().getHand();
hand.drop(blueFive, new Position(0, 0));
hand.drop(blueSix, new Position(0, 0));
hand.drop(blueSeven, new Position(0, 0));
hand.drop(redFour, new Position(0, 0));
hand.drop(blueFour, new Position(0, 0));
hand.drop(blackFour, new Position(0, 0));
hand.drop(orangeFour, new Position(0, 0));
view.handPanel.stoneClickEvent.emit(redFour, false);
view.handPanel.stoneClickEvent.emit(blueFour, true);
view.handPanel.stoneClickEvent.emit(blackFour, true);
view.handPanel.stoneClickEvent.emit(orangeFour, true);
view.tablePanel.clickEvent.emit(new Position(0, 0));
view.handPanel.stoneClickEvent.emit(blueFive, false);
view.handPanel.stoneClickEvent.emit(blueSix, true);
view.handPanel.stoneClickEvent.emit(blueSeven, true);
view.tablePanel.clickEvent.emit(new Position(0, 0));
view.playerPanel.endTurnEvent.emit();
assertEquals(2, roundState.getTable().getSize());
view.startTurnEvent.emit();
hand = roundState.getActivePlayer().getHand();
view.tablePanel.stoneClickEvent.emit(blueFour, false);
view.tablePanel.stoneClickEvent.emit(blueFive, true);
view.tablePanel.stoneClickEvent.emit(blueSix, true);
view.tablePanel.stoneClickEvent.emit(blueSeven, true);
assertFalse(roundState.getActivePlayer().getLaidOut());
view.tablePanel.clickEvent.emit(new Position(0, 0));
view.playerPanel.endTurnEvent.emit();
assertFalse(roundState
.getNthNextPlayer(roundState.getPlayerCount() - 1).getLaidOut());
assertEquals(2, roundState.getTable().getSize());
assertEquals(14 + 3, hand.getSize());
}
/** Threshold=30 */
@Test
public void laidOutValid() {
roundControl.startRound();
view.startTurnEvent.emit();
// Fake Turn to put stones on the table
Stone blueSeven = new Stone(7, BLUE);
Stone blackSeven = new Stone(7, BLACK);
Stone redSeven = new Stone(7, RED);
Stone orangeSeven = new Stone(7, ORANGE);
Stone blueOne = new Stone(1, BLUE);
Stone blueTwo = new Stone(2, BLUE);
Stone blueThree = new Stone(3, BLUE);
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));
view.handPanel.stoneClickEvent.emit(redSeven, false);
view.handPanel.stoneClickEvent.emit(blueSeven, true);
view.handPanel.stoneClickEvent.emit(blackSeven, true);
view.handPanel.stoneClickEvent.emit(orangeSeven, true);
view.tablePanel.clickEvent.emit(new Position(0, 0));
view.handPanel.stoneClickEvent.emit(blueOne, false);
view.handPanel.stoneClickEvent.emit(blueTwo, true);
view.handPanel.stoneClickEvent.emit(blueThree, true);
view.tablePanel.clickEvent.emit(new Position(0, 0));
view.playerPanel.endTurnEvent.emit();
assertTrue(roundState.getNthNextPlayer(roundState.getPlayerCount() - 1)
.getLaidOut());
assertEquals(2, roundState.getTable().getSize());
assertEquals(14, hand.getSize());
}
/** */
@Test
public void testDealStones() {
testRound.deal();
checkCorrectlyDealed();
for (int i = 0; i < 14; i++) {
testRound.dealStones(2);
}
assertEquals(2 * 14 + 14, testRoundState.getActivePlayer().getHand()
.getSize());
}
/** */
@Test
public void testDeal() {
testRound.deal();
checkCorrectlyDealed();
}
/** */
@Test
public void testStartRound() {
testRound.startRound();
checkCorrectlyDealed();
checkTurnStartSetUp();
}
/** */
@Test
public void testTableDisplay() {
testRound.startRound();
checkCorrectlyDealed();
view.startTurnEvent.emit();
checkTableDisplay();
view.getPlayerPanel().endTurnEvent.emit();
}
/** */
@Test
public void testTableValidHandChanged() {
testRoundState.players.get(0).setLaidOut(true);
testRound.startRound();
MockTable oldTable = testRoundState.table;
testTable.valid = true;
oldTable.clonedTable = testTable;
view.startTurnEvent.emit();
assertFalse(view.displayStartTurnPanel);
IHand hand = testRoundState.players.get(0).hand;
hand.pickUp(hand.iterator().next().getFirst());
resetTurnStart();
view.getPlayerPanel().endTurnEvent.emit();
assertSame(testTable, testRoundState.setTable);
assertEquals(1, testRoundState.activePlayer);
checkTurnStartSetUp();
}
/** */
@Test
public void testTableInvalidHandChanged() {
testRound.startRound();
MockTable oldTable = testRoundState.table;
testTable.valid = false;
oldTable.clonedTable = testTable;
view.startTurnEvent.emit();
assertFalse(view.displayStartTurnPanel);
IHand hand = testRoundState.players.get(0).hand;
Stone stone = hand.iterator().next().getFirst();
hand.pickUp(stone);
testTable.drop(new StoneSet(stone), new Position(0, 0));
resetTurnStart();
view.getPlayerPanel().endTurnEvent.emit();
assertNull(testRoundState.setTable);
assertEquals(1, testRoundState.activePlayer);
assertEquals(14 + 3, testRoundState.players.get(0).hand.getSize());
checkTurnStartSetUp();
}
/** */
@Test
public void testTableValidHandUnchanged() {
testRoundState.players.get(0).setLaidOut(true);
testRound.startRound();
MockTable oldTable = testRoundState.table;
testTable.valid = true;
oldTable.clonedTable = testTable;
view.startTurnEvent.emit();
assertFalse(view.displayStartTurnPanel);
resetTurnStart();
view.getPlayerPanel().endTurnEvent.emit();
assertSame(testTable, testRoundState.setTable);
assertEquals(14 + 1, testRoundState.players.get(0).hand.getSize());
assertEquals(1, testRoundState.activePlayer);
checkTurnStartSetUp();
}
/** */
@Test
public void testTableInvalidHandUnchanged() {
testRoundState.players.get(1).setLaidOut(true);
testRound.startRound();
MockTable oldTable = testRoundState.table;
testTable.valid = false;
oldTable.clonedTable = testTable;
view.startTurnEvent.emit();
assertFalse(view.displayStartTurnPanel);
resetTurnStart();
view.getPlayerPanel().endTurnEvent.emit();
assertNull(testRoundState.setTable);
assertEquals(14 + 3, testRoundState.players.get(0).hand.getSize());
assertEquals(1, testRoundState.activePlayer);
checkTurnStartSetUp();
}
/** */
@Test
public void testWinning() {
testRound.startRound();
MockTable oldTable = testRoundState.table;
testTable.valid = true;
oldTable.clonedTable = testTable;
view.startTurnEvent.emit();
assertFalse(view.displayStartTurnPanel);
IHand hand = testRoundState.players.get(0).hand;
Stone blueEight = new Stone(8, BLUE);
Stone blackEight = new Stone(8, BLACK);
Stone redEight = new Stone(8, RED);
Stone orangeEight = new Stone(8, ORANGE);
hand.drop(redEight, new Position(0, 0));
hand.drop(blueEight, new Position(0, 0));
hand.drop(blackEight, new Position(0, 0));
hand.drop(orangeEight, new Position(0, 0));
view.handPanel.stoneClickEvent.emit(redEight, false);
view.handPanel.stoneClickEvent.emit(blueEight, true);
view.handPanel.stoneClickEvent.emit(blackEight, true);
view.handPanel.stoneClickEvent.emit(orangeEight, true);
view.tablePanel.clickEvent.emit(new Position(0, 0));
testRoundState.players.get(0).hand = new Hand(gameSettings);
resetTurnStart();
view.playerPanel.endTurnEvent.emit();
assertTrue(view.displayWinPanel);
}
/** */
@Test
public void testTableDifference() {
MockTable oldTable = new MockTable();
MockTable newTable = new MockTable();
Stone blueOne = new Stone(1, BLUE);
Stone redOne = new Stone(1, RED);
Stone blackOne = new Stone(1, BLACK);
Stone blueTwo = new Stone(2, BLUE);
Stone blueThree = new Stone(3, BLUE);
Stone blueFour = new Stone(4, BLUE);
StoneSet oldSet1 = new StoneSet(
Arrays.asList(blueOne, redOne, blackOne));
StoneSet oldSet2 = new StoneSet(blueTwo);
oldTable.drop(oldSet1, new Position(0, 0));
oldTable.drop(oldSet2, new Position(0, 0));
StoneSet newSet1 = new StoneSet(Arrays.asList(blueOne, blueTwo,
blueFour));
StoneSet newSet2 = new StoneSet(Arrays.asList(redOne, blackOne,
blueThree));
newTable.drop(newSet1, new Position(0, 0));
newTable.drop(newSet2, new Position(0, 0));
Set<Stone> expectedStones = new HashSet<Stone>();
expectedStones.add(blueThree);
expectedStones.add(blueFour);
Set<Stone> stones = RoundControl.tableDifference(oldTable, newTable);
assertTrue(expectedStones.containsAll(stones));
assertTrue(stones.containsAll(expectedStones));
}
@Test
public void testTableSetDifference() {
ITable oldTable = new Table();
Stone blueOne = new Stone(1, BLUE);
Stone redOne = new Stone(1, RED);
Stone blackOne = new Stone(1, BLACK);
Stone orangeOne = new Stone(1, ORANGE);
Stone blueTwo = new Stone(2, BLUE);
Stone blueThree = new Stone(3, BLUE);
Stone blueFour = new Stone(4, BLUE);
StoneSet oldSet1 = new StoneSet(Arrays.asList(blueOne, redOne,
blackOne, orangeOne));
StoneSet oldSet2 = new StoneSet(Arrays.asList(blueTwo, blueThree,
blueFour));
oldTable.drop(oldSet1, new Position(0, 0));
oldTable.drop(oldSet2, new Position(0, 0));
ITable newTable = (Table) oldTable.clone();
List<StoneSet> newSets = RoundControl.tableSetDifference(oldTable,
newTable);
List<StoneSet> vanishedSets = RoundControl.tableSetDifference(newTable,
oldTable);
assertTrue(newSets.isEmpty());
assertTrue(vanishedSets.isEmpty());
newTable.pickUp(oldSet2);
newTable.drop(oldSet2.join(new StoneSet(new Stone(5, BLUE))),
new Position(0, 0));
newSets = RoundControl.tableSetDifference(oldTable, newTable);
vanishedSets = RoundControl.tableSetDifference(newTable, oldTable);
assertFalse(newSets.isEmpty());
assertFalse(vanishedSets.isEmpty());
assertEquals(1, newSets.size());
assertEquals(1, vanishedSets.size());
Stone redTwo = new Stone(2, RED);
Stone redThree = new Stone(3, RED);
Stone redFour = new Stone(4, RED);
StoneSet oldSet3 = new StoneSet(
Arrays.asList(redTwo, redThree, redFour));
ITable newTable2 = (Table) oldTable.clone();
newTable2.drop(oldSet3, new Position(0, 0));
newSets = RoundControl.tableSetDifference(oldTable, newTable2);
vanishedSets = RoundControl.tableSetDifference(newTable2, oldTable);
assertFalse(newSets.isEmpty());
assertTrue(vanishedSets.isEmpty());
assertEquals(1, newSets.size());
}
@Test
public void heapIsEmpty() {
roundState.getGameHeap().drawStones(106 - 14 * 4 - 1);
roundControl.startRound();
IPlayer player1 = roundState.getActivePlayer();
view.startTurnEvent.emit();
view.playerPanel.endTurnEvent.emit(); // player 1 draws a card here
assertSame(player1, roundState.getActivePlayer());
for (int i = 0; i < 4; i++) {
view.startTurnEvent.emit();
view.playerPanel.endTurnEvent.emit();
}
assertTrue(view.displayWinPanel);
}
}