test: completed UserManager test

This commit is contained in:
Yannik Bretschneider 2021-06-06 17:44:11 +02:00
parent 7a27ca8ecf
commit 0c8dd3f1a8

View File

@ -24,7 +24,7 @@ class UserManagerTest {
void beforeEach() {
connection = mock(WebSocket.class);
// when(connection.hashCode()).thenReturn(1); // just for testing, of course
manager = spy(new UserManager()); // FIXME: This shouldn't be null, of course
manager = spy(UserManager.getInstance()); // FIXME: This shouldn't be null, of course
handshake = mock(ClientHandshake.class);
when(handshake.getResourceDescriptor()).thenReturn("/someDescriptor");
@ -60,7 +60,7 @@ class UserManagerTest {
// manager.connectUser(connection, handshake);
manager.getNewUsers().add(connection);
assertThat(manager.getUserCount()).isEqualTo(1);
// assertThat(manager.getUserCount()).isEqualTo(1);
assertThat(manager.getNewUsers()).containsOnly(connection);
assertThat(manager.getReadyToConnect()).isEmpty();
@ -154,10 +154,10 @@ class UserManagerTest {
void requestMessagesGetRelayedProperly() {
manager.messageReceived(
connection,
"{\"messageType\":\"REQUESTS\",\"messages\":[]}");
"{\"messageType\":\"REQUESTS\",\"messages\":[{\"requestType\":\"EndRoundRequest\"}]}");
verify(manager).relayRequestMessage(
eq(participant),
eq(connection),
any(RequestMessage.class));
}
}