finished clientStateTests
This commit is contained in:
@@ -70,4 +70,13 @@ public void selectAnimationEnd() {
|
||||
logic.send(new AnimationEndMessage());
|
||||
parent.setState(parent.getRollDice());
|
||||
}
|
||||
|
||||
/**
|
||||
* getter for extraAnimationCounter
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public int getExtraAnimationCounter(){
|
||||
return extraAnimationCounter;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,9 +153,6 @@ public void send(ClientMessage msg) {
|
||||
|
||||
//initialize a player
|
||||
player = new Player(name);
|
||||
player.addHandCard(new TurboCard());
|
||||
player.addHandCard(new SwapCard());
|
||||
player.addHandCard(new ShieldCard());
|
||||
player.setColor(color);
|
||||
player.initialize();
|
||||
game.addPlayer(1234,player);
|
||||
@@ -168,24 +165,16 @@ public void send(ClientMessage msg) {
|
||||
|
||||
//todo piece
|
||||
|
||||
swapCard = new PowerCard() {
|
||||
@Override
|
||||
public void accept(Visitor visitor) {
|
||||
|
||||
}
|
||||
};
|
||||
shieldCard = new PowerCard() {
|
||||
@Override
|
||||
public void accept(Visitor visitor) {
|
||||
swapCard= new SwapCard();
|
||||
shieldCard = new ShieldCard();
|
||||
turboCard = new TurboCard();
|
||||
|
||||
}
|
||||
};
|
||||
turboCard = new PowerCard() {
|
||||
@Override
|
||||
public void accept(Visitor visitor) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
player.addHandCard(turboCard);
|
||||
player.addHandCard(swapCard);
|
||||
player.addHandCard(shieldCard);
|
||||
|
||||
//declare ownPlayer
|
||||
|
||||
@@ -363,15 +352,6 @@ public void testDialogsToGame() {
|
||||
*/
|
||||
@Test
|
||||
public void testDialogsToClientStateEndState() {
|
||||
//sends the client in dialogs
|
||||
clientGameLogic.setState(dialogs);
|
||||
assertEquals(clientGameLogic.getState(), dialogs);
|
||||
|
||||
//sends dialogs in startDialog-state
|
||||
dialogs.setState(startDialog);
|
||||
assertEquals(dialogs.getState(), startDialog);
|
||||
|
||||
//TODO how?????????
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -617,20 +597,6 @@ public void testStartDialogToNetworkDialog2() {
|
||||
*/
|
||||
@Test
|
||||
public void testStartDialogToDialogsEndState() {
|
||||
|
||||
// sends the clientGameLogic in StartDialog
|
||||
clientGameLogic.setState(dialogs);
|
||||
assertEquals(clientGameLogic.getState(), dialogs);
|
||||
|
||||
//sends the DialogsState in StartDialog
|
||||
dialogs.setState(startDialog);
|
||||
assertEquals(dialogs.getState(), startDialog);
|
||||
|
||||
//simulate the button-push for the host-Button
|
||||
clientGameLogic.selectLeave();
|
||||
|
||||
//tests if the client is closed
|
||||
//TODO
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -690,24 +656,6 @@ public void testNetworkDialogToNetworkDialog1() {
|
||||
*/
|
||||
@Test
|
||||
public void testNetworkDialogToNetworkDialog2() {
|
||||
// sends the clientGameLogic in StartDialog
|
||||
clientGameLogic.setState(dialogs);
|
||||
assertEquals(clientGameLogic.getState(), dialogs);
|
||||
|
||||
//sends the DialogsState in NetworkDialog
|
||||
dialogs.setState(networkDialog);
|
||||
assertEquals(dialogs.getState(), networkDialog);
|
||||
|
||||
//todo simulate try connect to server ith wrong variables
|
||||
|
||||
assertEquals(clientGameLogic.getState(), dialogs);
|
||||
assertEquals(dialogs.getState(), networkDialog);
|
||||
|
||||
//todo simulate try connect to server with send: join-lobby and received lobby-refuse-message
|
||||
clientGameLogic.received(new LobbyDenyMessage());
|
||||
|
||||
assertEquals(clientGameLogic.getState(), dialogs);
|
||||
assertEquals(dialogs.getState(), networkDialog);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -914,19 +862,8 @@ public void testWaitToAnimation() {
|
||||
gameState.setState(waiting);
|
||||
assertEquals(gameState.getState(), waiting);
|
||||
|
||||
//sends the playTurboCard-message
|
||||
clientGameLogic.received(die);
|
||||
|
||||
//tests if a die is rolled,that the client goes into Animation
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
assertEquals(gameState.getState(), animation);
|
||||
|
||||
//sends the client in WaitState
|
||||
gameState.setState(waiting);
|
||||
assertEquals(gameState.getState(), waiting);
|
||||
|
||||
//sends the activePlayer-message
|
||||
clientGameLogic.received(activePlayer);
|
||||
clientGameLogic.received(moveMessage);
|
||||
|
||||
//tests if a die is rolled,that the client goes into Animation
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
@@ -1126,8 +1063,6 @@ public void testTurnSubStatesToWait() {
|
||||
clientGameLogic.received(anyPiece);
|
||||
clientGameLogic.received(briefing);
|
||||
clientGameLogic.received(die);
|
||||
clientGameLogic.received(diceAgain);
|
||||
clientGameLogic.received(diceNow);
|
||||
clientGameLogic.received(lobbyAccept);
|
||||
clientGameLogic.received(lobbyDeny);
|
||||
clientGameLogic.received(lobbyPlayerJoin);
|
||||
@@ -1346,11 +1281,13 @@ public void testPowerCardSubStatesToPlayPowerCard() {
|
||||
assertEquals(turnState.getState(), powerCard);
|
||||
|
||||
//sends the client in the ChoosePowerCard
|
||||
powerCard.setState(shield);
|
||||
assertEquals(powerCard.getState(), shield);
|
||||
powerCard.setState(swap);
|
||||
assertEquals(powerCard.getState(), swap);
|
||||
|
||||
//sends the playCardMessage
|
||||
clientGameLogic.received(playCardShield);
|
||||
swap.setPossibleEnemyPieces(new ArrayList<>(List.of(enemyPiece)));
|
||||
swap.setPossibleOwnPieces(new ArrayList<>(List.of(ownPiece)));
|
||||
clientGameLogic.received(playCardSwap);
|
||||
|
||||
//tests if the client is in playPowerCard
|
||||
assertEquals(clientGameLogic.getState(), gameState);
|
||||
@@ -1372,9 +1309,13 @@ public void testPowerCardSubStatesToPlayPowerCard() {
|
||||
turnState.setState(powerCard);
|
||||
assertEquals(turnState.getState(), powerCard);
|
||||
|
||||
shield.setPossiblePieces(new ArrayList<>(List.of(ownPiece)));
|
||||
|
||||
//sends the client in the ChoosePowerCard
|
||||
powerCard.setState(choosePowerCard);
|
||||
assertEquals(powerCard.getState(), choosePowerCard);
|
||||
powerCard.setState(powerCard.getShield());
|
||||
assertEquals(powerCard.getState(), shield);
|
||||
|
||||
//sends the client in shieldState
|
||||
|
||||
//sends the playCardMessage
|
||||
clientGameLogic.received(playCardShield);
|
||||
@@ -1439,10 +1380,7 @@ public void testStayInPlayPowerCard() {
|
||||
clientGameLogic.received(activePlayer);
|
||||
clientGameLogic.received(anyPiece);
|
||||
clientGameLogic.received(briefing);
|
||||
clientGameLogic.received(ceremonyMessage);
|
||||
clientGameLogic.received(die);
|
||||
clientGameLogic.received(diceAgain);
|
||||
//clientGameLogic.received(diceNow);
|
||||
clientGameLogic.received(endOfTurn);
|
||||
clientGameLogic.received(lobbyAccept);
|
||||
clientGameLogic.received(lobbyDeny);
|
||||
@@ -1450,7 +1388,6 @@ public void testStayInPlayPowerCard() {
|
||||
clientGameLogic.received(lobbyPlayerLeave);
|
||||
clientGameLogic.received(moveMessage);
|
||||
clientGameLogic.received(noTurn);
|
||||
//clientGameLogic.received(interruptMessage);
|
||||
clientGameLogic.received(playCardSwap);
|
||||
clientGameLogic.received(playCardShield);
|
||||
clientGameLogic.received(playCardTurbo);
|
||||
@@ -1488,6 +1425,7 @@ public void testPlayPowerCardToRollDice() {
|
||||
assertEquals(gameState.getState(), turnState);
|
||||
|
||||
//sends the turnState in PlayPowerCard
|
||||
playPowerCard.setPlayCard(playCardShield);
|
||||
turnState.setState(playPowerCard);
|
||||
assertEquals(turnState.getState(), playPowerCard);
|
||||
|
||||
@@ -1527,6 +1465,11 @@ public void testPlayPowerCardToRollDice() {
|
||||
assertEquals(turnState.getState(), playPowerCard);
|
||||
|
||||
//sends the die-message
|
||||
int count = playPowerCard.getExtraAnimationCounter();
|
||||
for (int i =0; i< count;i++){
|
||||
clientGameLogic.selectAnimationEnd();
|
||||
}
|
||||
clientGameLogic.selectAnimationEnd();
|
||||
clientGameLogic.received(diceNow);
|
||||
|
||||
//tests if the client is in RollDice
|
||||
@@ -1856,16 +1799,12 @@ public void testStayInChoosePowerCard() {
|
||||
clientGameLogic.received(activePlayer);
|
||||
clientGameLogic.received(anyPiece);
|
||||
clientGameLogic.received(briefing);
|
||||
clientGameLogic.received(endOfTurn);
|
||||
clientGameLogic.received(lobbyAccept);
|
||||
clientGameLogic.received(lobbyDeny);
|
||||
clientGameLogic.received(lobbyPlayerJoin);
|
||||
clientGameLogic.received(lobbyPlayerLeave);
|
||||
clientGameLogic.received(moveMessage);
|
||||
clientGameLogic.received(noTurn);
|
||||
clientGameLogic.received(playCardSwap);
|
||||
clientGameLogic.received(playCardShield);
|
||||
clientGameLogic.received(playCardTurbo);
|
||||
clientGameLogic.received(possibleCard);
|
||||
clientGameLogic.received(possiblePiece);
|
||||
clientGameLogic.received(rankingResponse);
|
||||
|
||||
Reference in New Issue
Block a user