edted some tests with null tests

This commit is contained in:
Benjamin Feyer
2024-11-25 16:32:51 +01:00
committed by Felix
parent e18ea15efa
commit 9859d52e02

View File

@@ -13,6 +13,8 @@
import java.util.ArrayList; import java.util.ArrayList;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
/** /**
@@ -131,12 +133,12 @@ public void setUp() {
lobbyDeny = new LobbyDeny(); lobbyDeny = new LobbyDeny();
lobbyPlayerJoin = new LobbyPlayerJoin(name); lobbyPlayerJoin = new LobbyPlayerJoin(name);
lobbyPlayerLeave = new LobbyPlayerLeave(name,color); lobbyPlayerLeave = new LobbyPlayerLeave(name,color);
moveMessage = new MoveMessage(); moveMessage = new MoveMessage("www");//Todo
noTurn = new NoTurn(); noTurn = new NoTurn();
pauseGame = new PauseGame(); pauseGame = new PauseGame();
playCardSwap = new PlayCard(swapCard); playCardSwap = new PlayCard(swapCard,"www");//Todo
playCardShield = new PlayCard(shieldCard); playCardShield = new PlayCard(shieldCard,"www");//Todo
playCardTurbo = new PlayCard(turboCard); playCardTurbo = new PlayCard(turboCard,"www");//Todo
possibleCard = new PossibleCard(); possibleCard = new PossibleCard();
possiblePiece = new PossiblePiece(); possiblePiece = new PossiblePiece();
rankingResponce = new RankingResponse(); rankingResponce = new RankingResponse();
@@ -144,9 +146,9 @@ public void setUp() {
reconnectBriefing = new ReconnectBriefing(game); reconnectBriefing = new ReconnectBriefing(game);
resumeGame = new ResumeGame(); resumeGame = new ResumeGame();
startGame = new ServerStartGame(); startGame = new ServerStartGame();
startPieceMessage = new StartPiece(); startPieceMessage = new StartPiece(); //Todo wrong class
updateReady = new UpdateReady(); updateReady = new UpdateReady(color,true);
updateTSK = new UpdateTSK(); updateTSK = new UpdateTSK(name,color);
waitPiece = new WaitPiece(); waitPiece = new WaitPiece();
//initialize the clientGameLogic //initialize the clientGameLogic
@@ -162,7 +164,7 @@ public void send(ClientMessage msg) {
mainSettings = new MainSettings(settingsStateMachine,clientGameLogic); mainSettings = new MainSettings(settingsStateMachine,clientGameLogic);
videoSettings = new VideoSettings(settingsStateMachine,clientGameLogic); videoSettings = new VideoSettings(settingsStateMachine,clientGameLogic);
audioSettings = new AudioSettings(settingsStateMachine,clientGameLogic); audioSettings = new AudioSettings(settingsStateMachine,clientGameLogic);
settings = new Settings(); settings = new Settings(clientAutomaton,clientGameLogic);
//initialize the stateMachines //initialize the stateMachines
@@ -220,10 +222,12 @@ public void send(ClientMessage msg) {
@Test @Test
public void testInitialStateClientState() { public void testInitialStateClientState() {
//tests if the clientAutomaton is in Dialogs //tests if the clientAutomaton is in Dialogs
assertNotEquals(clientAutomaton.getState() , null);
assertTrue(clientAutomaton.getState() instanceof Dialogs); assertTrue(clientAutomaton.getState() instanceof Dialogs);
Dialogs dialogs = (Dialogs) clientAutomaton.getState(); Dialogs dialogs = (Dialogs) clientAutomaton.getState();
DialogsStateMachine dialogsStateMachine1 = dialogs.getDialogsStateMachine(); DialogsStateMachine dialogsStateMachine1 = dialogs.getDialogsStateMachine();
//tests if the statemachine is in StartDialog //tests if the statemachine is in StartDialog
assertNotEquals(dialogsStateMachine1.getState(), null);
assertTrue(dialogsStateMachine1.getState() instanceof StartDialog); assertTrue(dialogsStateMachine1.getState() instanceof StartDialog);
} }
@@ -603,7 +607,7 @@ public void testWaitToAnimation() {
assertTrue(gameStateMachine.getState() instanceof Waiting); assertTrue(gameStateMachine.getState() instanceof Waiting);
//tests if a powerCard is played,that the client goes into Animation //tests if a powerCard is played,that the client goes into Animation
clientGameLogic.receive(playCard); //Todo ??? richtige message clientGameLogic.receive(playCardTurbo); //Todo ??? richtige message
assertTrue(clientAutomaton.getState() instanceof GameState); assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(gameStateMachine.getState() instanceof Animation); assertTrue(gameStateMachine.getState() instanceof Animation);