test: added test for spectator joins full lobby (need fix)
This commit is contained in:
parent
4e39d01ac6
commit
4ed6d23be6
@ -260,4 +260,47 @@ class LobbyManagerTest {
|
|||||||
.isEqualTo(manager.getLobbies().get(player3Participant));
|
.isEqualTo(manager.getLobbies().get(player3Participant));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Spectator joins full lobby")
|
||||||
|
void spactatorsJoinLobby(){
|
||||||
|
when(player1.getResourceDescriptor()).thenReturn(null);
|
||||||
|
when(player2.getResourceDescriptor()).thenReturn(null);
|
||||||
|
|
||||||
|
Participant player1Participant = new Participant(player1, ParticipantType.PlayerOne, "playerOne");
|
||||||
|
Participant player2Participant = new Participant(player2, ParticipantType.PlayerTwo, "playerTwo");
|
||||||
|
Participant spectator1 = new Participant(spectator, ParticipantType.Spectator, "spectator1");
|
||||||
|
Participant spectator2 = new Participant(spectator, ParticipantType.Spectator, "spectator2");
|
||||||
|
|
||||||
|
manager.assignLobbyToConnection(player1, "playerOne", playerReady);
|
||||||
|
manager.assignLobbyToConnection(player2, "playerTwo", playerReady);
|
||||||
|
manager.assignLobbyToConnection(spectator, "spectator1", spectatorReady);
|
||||||
|
manager.assignLobbyToConnection(spectator, "spectator2", spectatorReady);
|
||||||
|
|
||||||
|
assertThat(manager.getResourceDescriptorToLobby()).hasSize(2);
|
||||||
|
assertThat(manager.getLobbies()).containsOnlyKeys(
|
||||||
|
player1Participant,
|
||||||
|
player2Participant,
|
||||||
|
spectator1,
|
||||||
|
spectator2
|
||||||
|
);
|
||||||
|
assertThat(manager.getLobbies().get(player1Participant))
|
||||||
|
.isNotNull()
|
||||||
|
.isEqualTo(manager.getLobbies().get(player2Participant));
|
||||||
|
assertThat(manager.getLobbies().get(spectator1))
|
||||||
|
.isNotNull()
|
||||||
|
.isEqualTo(manager.getLobbies().get(spectator2));
|
||||||
|
|
||||||
|
// TODO: Why are the following tests wrong?
|
||||||
|
|
||||||
|
// assertThat(manager.getResourceDescriptorToLobby().get(manager.getLobbies().get(player1Participant).gameID))
|
||||||
|
// .isNotNull()
|
||||||
|
// .isEqualTo(manager.getLobbies().get(player1Participant))
|
||||||
|
// .isEqualTo(manager.getLobbies().get(player2Participant))
|
||||||
|
// .isEqualTo(manager.getLobbies().get(spectator1))
|
||||||
|
// .isEqualTo(manager.getLobbies().get(spectator2));
|
||||||
|
// assertThat(manager.getResourceDescriptorToLobby().get(manager.getLobbies().get(player1Participant).gameID))
|
||||||
|
// .isEqualTo(manager.getResourceDescriptorToLobby().get(manager.getLobbies().get(player2Participant).gameID))
|
||||||
|
// .isEqualTo(manager.getResourceDescriptorToLobby().get(manager.getLobbies().get(spectator1).gameID))
|
||||||
|
// .isEqualTo(manager.getResourceDescriptorToLobby().get(manager.getLobbies().get(spectator2).gameID));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user