git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@122 72836036-5685-4462-b002-a69064685172
48 lines
1.2 KiB
Java
48 lines
1.2 KiB
Java
package jrummikub.control;
|
|
|
|
import static org.junit.Assert.*;
|
|
import jrummikub.model.GameState;
|
|
import jrummikub.view.MockView;
|
|
|
|
import org.junit.Before;
|
|
import org.junit.Test;
|
|
|
|
public class RoundControlTest {
|
|
private MockView view;
|
|
private GameState testGameState;
|
|
private RoundControl testRound;
|
|
|
|
@Before
|
|
public void setup() {
|
|
view = new MockView();
|
|
testGameState = new GameState();
|
|
testRound = new RoundControl(testGameState, view);
|
|
}
|
|
|
|
private void checkCorrectlyDealed() {
|
|
assertEquals(106 - testGameState.getPlayerCount() * 14, testGameState
|
|
.getGameHeap().getSize());
|
|
for (int i = 0; i < testGameState.getPlayerCount(); i++) {
|
|
assertEquals(14, testGameState.getPlayer(i).getHand().getSize());
|
|
}
|
|
}
|
|
|
|
@Test
|
|
public void testDeal() {
|
|
testRound.deal();
|
|
checkCorrectlyDealed();
|
|
}
|
|
|
|
@Test
|
|
public void testStartRound() {
|
|
testRound.startRound();
|
|
checkCorrectlyDealed();
|
|
|
|
assertNotNull(view.currentPlayerName);
|
|
assertNotNull(view.getTablePanel().leftPlayerName);
|
|
assertNotNull(view.getTablePanel().topPlayerName);
|
|
assertNotNull(view.getTablePanel().rightPlayerName);
|
|
assertTrue(view.displayStartTurnPanel);
|
|
assertFalse(view.startTurnEvent.listeners.isEmpty());
|
|
}
|
|
}
|