finished clientStateTests
This commit is contained in:
@@ -70,4 +70,13 @@ public void selectAnimationEnd() {
|
|||||||
logic.send(new AnimationEndMessage());
|
logic.send(new AnimationEndMessage());
|
||||||
parent.setState(parent.getRollDice());
|
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
|
//initialize a player
|
||||||
player = new Player(name);
|
player = new Player(name);
|
||||||
player.addHandCard(new TurboCard());
|
|
||||||
player.addHandCard(new SwapCard());
|
|
||||||
player.addHandCard(new ShieldCard());
|
|
||||||
player.setColor(color);
|
player.setColor(color);
|
||||||
player.initialize();
|
player.initialize();
|
||||||
game.addPlayer(1234,player);
|
game.addPlayer(1234,player);
|
||||||
@@ -168,24 +165,16 @@ public void send(ClientMessage msg) {
|
|||||||
|
|
||||||
//todo piece
|
//todo piece
|
||||||
|
|
||||||
swapCard = new PowerCard() {
|
|
||||||
@Override
|
|
||||||
public void accept(Visitor visitor) {
|
|
||||||
|
|
||||||
}
|
swapCard= new SwapCard();
|
||||||
};
|
shieldCard = new ShieldCard();
|
||||||
shieldCard = new PowerCard() {
|
turboCard = new TurboCard();
|
||||||
@Override
|
|
||||||
public void accept(Visitor visitor) {
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
turboCard = new PowerCard() {
|
|
||||||
@Override
|
|
||||||
public void accept(Visitor visitor) {
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
player.addHandCard(turboCard);
|
||||||
|
player.addHandCard(swapCard);
|
||||||
|
player.addHandCard(shieldCard);
|
||||||
|
|
||||||
//declare ownPlayer
|
//declare ownPlayer
|
||||||
|
|
||||||
@@ -363,15 +352,6 @@ public void testDialogsToGame() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testDialogsToClientStateEndState() {
|
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
|
@Test
|
||||||
public void testStartDialogToDialogsEndState() {
|
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
|
@Test
|
||||||
public void testNetworkDialogToNetworkDialog2() {
|
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);
|
gameState.setState(waiting);
|
||||||
assertEquals(gameState.getState(), 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
|
//sends the activePlayer-message
|
||||||
clientGameLogic.received(activePlayer);
|
clientGameLogic.received(moveMessage);
|
||||||
|
|
||||||
//tests if a die is rolled,that the client goes into Animation
|
//tests if a die is rolled,that the client goes into Animation
|
||||||
assertEquals(clientGameLogic.getState(), gameState);
|
assertEquals(clientGameLogic.getState(), gameState);
|
||||||
@@ -1126,8 +1063,6 @@ public void testTurnSubStatesToWait() {
|
|||||||
clientGameLogic.received(anyPiece);
|
clientGameLogic.received(anyPiece);
|
||||||
clientGameLogic.received(briefing);
|
clientGameLogic.received(briefing);
|
||||||
clientGameLogic.received(die);
|
clientGameLogic.received(die);
|
||||||
clientGameLogic.received(diceAgain);
|
|
||||||
clientGameLogic.received(diceNow);
|
|
||||||
clientGameLogic.received(lobbyAccept);
|
clientGameLogic.received(lobbyAccept);
|
||||||
clientGameLogic.received(lobbyDeny);
|
clientGameLogic.received(lobbyDeny);
|
||||||
clientGameLogic.received(lobbyPlayerJoin);
|
clientGameLogic.received(lobbyPlayerJoin);
|
||||||
@@ -1346,11 +1281,13 @@ public void testPowerCardSubStatesToPlayPowerCard() {
|
|||||||
assertEquals(turnState.getState(), powerCard);
|
assertEquals(turnState.getState(), powerCard);
|
||||||
|
|
||||||
//sends the client in the ChoosePowerCard
|
//sends the client in the ChoosePowerCard
|
||||||
powerCard.setState(shield);
|
powerCard.setState(swap);
|
||||||
assertEquals(powerCard.getState(), shield);
|
assertEquals(powerCard.getState(), swap);
|
||||||
|
|
||||||
//sends the playCardMessage
|
//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
|
//tests if the client is in playPowerCard
|
||||||
assertEquals(clientGameLogic.getState(), gameState);
|
assertEquals(clientGameLogic.getState(), gameState);
|
||||||
@@ -1372,9 +1309,13 @@ public void testPowerCardSubStatesToPlayPowerCard() {
|
|||||||
turnState.setState(powerCard);
|
turnState.setState(powerCard);
|
||||||
assertEquals(turnState.getState(), powerCard);
|
assertEquals(turnState.getState(), powerCard);
|
||||||
|
|
||||||
|
shield.setPossiblePieces(new ArrayList<>(List.of(ownPiece)));
|
||||||
|
|
||||||
//sends the client in the ChoosePowerCard
|
//sends the client in the ChoosePowerCard
|
||||||
powerCard.setState(choosePowerCard);
|
powerCard.setState(powerCard.getShield());
|
||||||
assertEquals(powerCard.getState(), choosePowerCard);
|
assertEquals(powerCard.getState(), shield);
|
||||||
|
|
||||||
|
//sends the client in shieldState
|
||||||
|
|
||||||
//sends the playCardMessage
|
//sends the playCardMessage
|
||||||
clientGameLogic.received(playCardShield);
|
clientGameLogic.received(playCardShield);
|
||||||
@@ -1439,10 +1380,7 @@ public void testStayInPlayPowerCard() {
|
|||||||
clientGameLogic.received(activePlayer);
|
clientGameLogic.received(activePlayer);
|
||||||
clientGameLogic.received(anyPiece);
|
clientGameLogic.received(anyPiece);
|
||||||
clientGameLogic.received(briefing);
|
clientGameLogic.received(briefing);
|
||||||
clientGameLogic.received(ceremonyMessage);
|
|
||||||
clientGameLogic.received(die);
|
clientGameLogic.received(die);
|
||||||
clientGameLogic.received(diceAgain);
|
|
||||||
//clientGameLogic.received(diceNow);
|
|
||||||
clientGameLogic.received(endOfTurn);
|
clientGameLogic.received(endOfTurn);
|
||||||
clientGameLogic.received(lobbyAccept);
|
clientGameLogic.received(lobbyAccept);
|
||||||
clientGameLogic.received(lobbyDeny);
|
clientGameLogic.received(lobbyDeny);
|
||||||
@@ -1450,7 +1388,6 @@ public void testStayInPlayPowerCard() {
|
|||||||
clientGameLogic.received(lobbyPlayerLeave);
|
clientGameLogic.received(lobbyPlayerLeave);
|
||||||
clientGameLogic.received(moveMessage);
|
clientGameLogic.received(moveMessage);
|
||||||
clientGameLogic.received(noTurn);
|
clientGameLogic.received(noTurn);
|
||||||
//clientGameLogic.received(interruptMessage);
|
|
||||||
clientGameLogic.received(playCardSwap);
|
clientGameLogic.received(playCardSwap);
|
||||||
clientGameLogic.received(playCardShield);
|
clientGameLogic.received(playCardShield);
|
||||||
clientGameLogic.received(playCardTurbo);
|
clientGameLogic.received(playCardTurbo);
|
||||||
@@ -1488,6 +1425,7 @@ public void testPlayPowerCardToRollDice() {
|
|||||||
assertEquals(gameState.getState(), turnState);
|
assertEquals(gameState.getState(), turnState);
|
||||||
|
|
||||||
//sends the turnState in PlayPowerCard
|
//sends the turnState in PlayPowerCard
|
||||||
|
playPowerCard.setPlayCard(playCardShield);
|
||||||
turnState.setState(playPowerCard);
|
turnState.setState(playPowerCard);
|
||||||
assertEquals(turnState.getState(), playPowerCard);
|
assertEquals(turnState.getState(), playPowerCard);
|
||||||
|
|
||||||
@@ -1527,6 +1465,11 @@ public void testPlayPowerCardToRollDice() {
|
|||||||
assertEquals(turnState.getState(), playPowerCard);
|
assertEquals(turnState.getState(), playPowerCard);
|
||||||
|
|
||||||
//sends the die-message
|
//sends the die-message
|
||||||
|
int count = playPowerCard.getExtraAnimationCounter();
|
||||||
|
for (int i =0; i< count;i++){
|
||||||
|
clientGameLogic.selectAnimationEnd();
|
||||||
|
}
|
||||||
|
clientGameLogic.selectAnimationEnd();
|
||||||
clientGameLogic.received(diceNow);
|
clientGameLogic.received(diceNow);
|
||||||
|
|
||||||
//tests if the client is in RollDice
|
//tests if the client is in RollDice
|
||||||
@@ -1856,16 +1799,12 @@ public void testStayInChoosePowerCard() {
|
|||||||
clientGameLogic.received(activePlayer);
|
clientGameLogic.received(activePlayer);
|
||||||
clientGameLogic.received(anyPiece);
|
clientGameLogic.received(anyPiece);
|
||||||
clientGameLogic.received(briefing);
|
clientGameLogic.received(briefing);
|
||||||
clientGameLogic.received(endOfTurn);
|
|
||||||
clientGameLogic.received(lobbyAccept);
|
clientGameLogic.received(lobbyAccept);
|
||||||
clientGameLogic.received(lobbyDeny);
|
clientGameLogic.received(lobbyDeny);
|
||||||
clientGameLogic.received(lobbyPlayerJoin);
|
clientGameLogic.received(lobbyPlayerJoin);
|
||||||
clientGameLogic.received(lobbyPlayerLeave);
|
clientGameLogic.received(lobbyPlayerLeave);
|
||||||
clientGameLogic.received(moveMessage);
|
clientGameLogic.received(moveMessage);
|
||||||
clientGameLogic.received(noTurn);
|
clientGameLogic.received(noTurn);
|
||||||
clientGameLogic.received(playCardSwap);
|
|
||||||
clientGameLogic.received(playCardShield);
|
|
||||||
clientGameLogic.received(playCardTurbo);
|
|
||||||
clientGameLogic.received(possibleCard);
|
clientGameLogic.received(possibleCard);
|
||||||
clientGameLogic.received(possiblePiece);
|
clientGameLogic.received(possiblePiece);
|
||||||
clientGameLogic.received(rankingResponse);
|
clientGameLogic.received(rankingResponse);
|
||||||
|
|||||||
Reference in New Issue
Block a user