added some testmethods for the client testing the statechanges in the dialogs
This commit is contained in:
@@ -314,14 +314,17 @@ public void testClientInterruptToGame() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testInterruptToDialogs() {
|
public void testInterruptToDialogs() {
|
||||||
//TODO
|
|
||||||
//sends the ClientAutomaton in GameState
|
//sends the ClientAutomaton in GameState
|
||||||
clientAutomaton.gotoState(interrupt);
|
clientAutomaton.gotoState(interrupt);
|
||||||
|
|
||||||
//tests if the client is in GameState
|
//tests if the client is in GameState
|
||||||
assertTrue(clientAutomaton.getState() instanceof Interrupt);
|
assertTrue(clientAutomaton.getState() instanceof Interrupt);
|
||||||
|
|
||||||
//Todo
|
//Todo send the server-closed message and the leave option
|
||||||
|
|
||||||
|
assertTrue(clientAutomaton.getState() instanceof Dialogs);
|
||||||
|
Dialogs dialogs1 = (Dialogs) clientAutomaton.getState();
|
||||||
|
DialogsStateMachine dialogsStateMachine1 = dialogs1.getDialogsStateMachine();
|
||||||
|
assertTrue(dialogsStateMachine1.getState() instanceof StartDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -329,12 +332,21 @@ public void testInterruptToDialogs() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCeremonyToDialogs() {
|
public void testCeremonyToDialogs() {
|
||||||
// Todo Implementation goes here
|
|
||||||
//send the client in the ceremony
|
//send the client in the ceremony
|
||||||
clientAutomaton.gotoState(ceremony);
|
clientAutomaton.gotoState(ceremony);
|
||||||
assertTrue(clientAutomaton.getStates() instanceof Ceremony);
|
assertTrue(clientAutomaton.getState() instanceof Ceremony);
|
||||||
|
|
||||||
//Todo
|
//sends the ceremony machine in the statistics
|
||||||
|
CeremonyStateMachine ceremonyStateMachine1 = ceremony.getCeremonyStateMachine();
|
||||||
|
ceremonyStateMachine1.gotoState(statistics);
|
||||||
|
assertTrue(ceremonyStateMachine1.getState() instanceof Statistics);
|
||||||
|
|
||||||
|
//Todo simulate the button next
|
||||||
|
|
||||||
|
assertTrue(clientAutomaton.getState() instanceof Dialogs);
|
||||||
|
Dialogs dialogs1 = (Dialogs) clientAutomaton.getState();
|
||||||
|
DialogsStateMachine dialogsStateMachine1 = dialogs1.getDialogsStateMachine();
|
||||||
|
assertTrue(dialogsStateMachine1.getState() instanceof StartDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -342,7 +354,19 @@ public void testCeremonyToDialogs() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testStartDialogToNetworkDialog1() {
|
public void testStartDialogToNetworkDialog1() {
|
||||||
// Implementation goes here
|
// sends the clientAutomaton in StartDialog
|
||||||
|
clientAutomaton.gotoState(dialogs);
|
||||||
|
assertTrue(clientAutomaton.getState() instanceof Dialogs);
|
||||||
|
|
||||||
|
//sends the DialogsStateMachine in StartDialog
|
||||||
|
DialogsStateMachine dialogsStateMachine1 = dialogs.getDialogsStateMachine();
|
||||||
|
dialogsStateMachine1.gotoState(startDialog);
|
||||||
|
assertTrue(dialogsStateMachine1.getState() instanceof StartDialog);
|
||||||
|
|
||||||
|
//todo simulate pushBtn as client or host
|
||||||
|
|
||||||
|
assertTrue(clientAutomaton.getState() instanceof Dialogs);
|
||||||
|
assertTrue(dialogsStateMachine1.getState() instanceof NetworkDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -350,7 +374,19 @@ public void testStartDialogToNetworkDialog1() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testStartDialogToNetworkDialog2() {
|
public void testStartDialogToNetworkDialog2() {
|
||||||
// Implementation goes here
|
// sends the clientAutomaton in StartDialog
|
||||||
|
clientAutomaton.gotoState(dialogs);
|
||||||
|
assertTrue(clientAutomaton.getState() instanceof Dialogs);
|
||||||
|
|
||||||
|
//sends the DialogsStateMachine in StartDialog
|
||||||
|
DialogsStateMachine dialogsStateMachine1 = dialogs.getDialogsStateMachine();
|
||||||
|
dialogsStateMachine1.gotoState(startDialog);
|
||||||
|
assertTrue(dialogsStateMachine1.getState() instanceof StartDialog);
|
||||||
|
|
||||||
|
//todo simulate pushBtn as client or host
|
||||||
|
|
||||||
|
assertTrue(clientAutomaton.getState() instanceof Dialogs);
|
||||||
|
assertTrue(dialogsStateMachine1.getState() instanceof NetworkDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -359,6 +395,7 @@ public void testStartDialogToNetworkDialog2() {
|
|||||||
@Test
|
@Test
|
||||||
public void testStartDialogToDialogsEndState() {
|
public void testStartDialogToDialogsEndState() {
|
||||||
// Implementation goes here
|
// Implementation goes here
|
||||||
|
//TODO how to test?
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -366,7 +403,19 @@ public void testStartDialogToDialogsEndState() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testNetworkDialogToStartDialog() {
|
public void testNetworkDialogToStartDialog() {
|
||||||
// Implementation goes here
|
// sends the clientAutomaton in StartDialog
|
||||||
|
clientAutomaton.gotoState(dialogs);
|
||||||
|
assertTrue(clientAutomaton.getState() instanceof Dialogs);
|
||||||
|
|
||||||
|
//sends the DialogsStateMachine in NetworkDialog
|
||||||
|
DialogsStateMachine dialogsStateMachine1 = dialogs.getDialogsStateMachine();
|
||||||
|
dialogsStateMachine1.gotoState(networkDialog);
|
||||||
|
assertTrue(dialogsStateMachine1.getState() instanceof NetworkDialog);
|
||||||
|
|
||||||
|
//todo simulate pushBtn
|
||||||
|
|
||||||
|
assertTrue(clientAutomaton.getState() instanceof Dialogs);
|
||||||
|
assertTrue(dialogsStateMachine1.getState() instanceof StartDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -374,7 +423,19 @@ public void testNetworkDialogToStartDialog() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testNetworkDialogToNetworkDialog1() {
|
public void testNetworkDialogToNetworkDialog1() {
|
||||||
// Implementation goes here
|
// sends the clientAutomaton in StartDialog
|
||||||
|
clientAutomaton.gotoState(dialogs);
|
||||||
|
assertTrue(clientAutomaton.getState() instanceof Dialogs);
|
||||||
|
|
||||||
|
//sends the DialogsStateMachine in NetworkDialog
|
||||||
|
DialogsStateMachine dialogsStateMachine1 = dialogs.getDialogsStateMachine();
|
||||||
|
dialogsStateMachine1.gotoState(networkDialog);
|
||||||
|
assertTrue(dialogsStateMachine1.getState() instanceof NetworkDialog);
|
||||||
|
|
||||||
|
//todo test receiving all messages and making input
|
||||||
|
|
||||||
|
assertTrue(clientAutomaton.getState() instanceof Dialogs);
|
||||||
|
assertTrue(dialogsStateMachine1.getState() instanceof NetworkDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -382,7 +443,24 @@ public void testNetworkDialogToNetworkDialog1() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testNetworkDialogToNetworkDialog2() {
|
public void testNetworkDialogToNetworkDialog2() {
|
||||||
// Implementation goes here
|
// sends the clientAutomaton in StartDialog
|
||||||
|
clientAutomaton.gotoState(dialogs);
|
||||||
|
assertTrue(clientAutomaton.getState() instanceof Dialogs);
|
||||||
|
|
||||||
|
//sends the DialogsStateMachine in NetworkDialog
|
||||||
|
DialogsStateMachine dialogsStateMachine1 = dialogs.getDialogsStateMachine();
|
||||||
|
dialogsStateMachine1.gotoState(networkDialog);
|
||||||
|
assertTrue(dialogsStateMachine1.getState() instanceof NetworkDialog);
|
||||||
|
|
||||||
|
//todo simulate try connect to server ith wrong variables
|
||||||
|
|
||||||
|
assertTrue(clientAutomaton.getState() instanceof Dialogs);
|
||||||
|
assertTrue(dialogsStateMachine1.getState() instanceof NetworkDialog);
|
||||||
|
|
||||||
|
//todo simulate try connect to server with send: join-lobby and receive lobby-refuse-message
|
||||||
|
|
||||||
|
assertTrue(clientAutomaton.getState() instanceof Dialogs);
|
||||||
|
assertTrue(dialogsStateMachine1.getState() instanceof NetworkDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -390,7 +468,19 @@ public void testNetworkDialogToNetworkDialog2() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testNetworkDialogToLobby() {
|
public void testNetworkDialogToLobby() {
|
||||||
// Implementation goes here
|
// sends the clientAutomaton in StartDialog
|
||||||
|
clientAutomaton.gotoState(dialogs);
|
||||||
|
assertTrue(clientAutomaton.getState() instanceof Dialogs);
|
||||||
|
|
||||||
|
//sends the DialogsStateMachine in NetworkDialog
|
||||||
|
DialogsStateMachine dialogsStateMachine1 = dialogs.getDialogsStateMachine();
|
||||||
|
dialogsStateMachine1.gotoState(networkDialog);
|
||||||
|
assertTrue(dialogsStateMachine1.getState() instanceof NetworkDialog);
|
||||||
|
|
||||||
|
//todo simulate connect to server with send lobby request
|
||||||
|
|
||||||
|
assertTrue(clientAutomaton.getState() instanceof Dialogs);
|
||||||
|
assertTrue(dialogsStateMachine1.getState() instanceof Lobby);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -398,7 +488,19 @@ public void testNetworkDialogToLobby() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testLobbyToStartDialog() {
|
public void testLobbyToStartDialog() {
|
||||||
// Implementation goes here
|
// sends the clientAutomaton in StartDialog
|
||||||
|
clientAutomaton.gotoState(dialogs);
|
||||||
|
assertTrue(clientAutomaton.getState() instanceof Dialogs);
|
||||||
|
|
||||||
|
//sends the DialogsStateMachine in Lobby
|
||||||
|
DialogsStateMachine dialogsStateMachine1 = dialogs.getDialogsStateMachine();
|
||||||
|
dialogsStateMachine1.gotoState(lobby);
|
||||||
|
assertTrue(dialogsStateMachine1.getState() instanceof Lobby);
|
||||||
|
|
||||||
|
//todo simulate leave the lobby
|
||||||
|
|
||||||
|
assertTrue(clientAutomaton.getState() instanceof Dialogs);
|
||||||
|
assertTrue(dialogsStateMachine1.getState() instanceof StartDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -406,7 +508,19 @@ public void testLobbyToStartDialog() {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testStayInLobby() {
|
public void testStayInLobby() {
|
||||||
// Implementation goes here
|
// sends the clientAutomaton in StartDialog
|
||||||
|
clientAutomaton.gotoState(dialogs);
|
||||||
|
assertTrue(clientAutomaton.getState() instanceof Dialogs);
|
||||||
|
|
||||||
|
//sends the DialogsStateMachine in Lobby
|
||||||
|
DialogsStateMachine dialogsStateMachine1 = dialogs.getDialogsStateMachine();
|
||||||
|
dialogsStateMachine1.gotoState(lobby);
|
||||||
|
assertTrue(dialogsStateMachine1.getState() instanceof Lobby);
|
||||||
|
|
||||||
|
//todo send all messages that dont indicate a change-state
|
||||||
|
|
||||||
|
assertTrue(clientAutomaton.getState() instanceof Dialogs);
|
||||||
|
assertTrue(dialogsStateMachine1.getState() instanceof Lobby);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user