From 36285238ec1f821a6853eaa5963f8cb8ca401c7f Mon Sep 17 00:00:00 2001 From: Yannik Bretschneider Date: Sun, 6 Jun 2021 19:27:50 +0200 Subject: [PATCH] test: updated test for UserManager --- .../server/netconnector/UserManagerTest.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Server/src/test/java/uulm/teamname/marvelous/server/netconnector/UserManagerTest.java b/Server/src/test/java/uulm/teamname/marvelous/server/netconnector/UserManagerTest.java index fdd1af2..6a3d63e 100644 --- a/Server/src/test/java/uulm/teamname/marvelous/server/netconnector/UserManagerTest.java +++ b/Server/src/test/java/uulm/teamname/marvelous/server/netconnector/UserManagerTest.java @@ -9,6 +9,8 @@ import uulm.teamname.marvelous.gamelibrary.messages.ParticipantType; import uulm.teamname.marvelous.gamelibrary.messages.client.*; import uulm.teamname.marvelous.server.lobbymanager.Participant; +import java.lang.reflect.InvocationTargetException; + import static org.mockito.Mockito.*; import static org.assertj.core.api.Assertions.*; @@ -21,10 +23,13 @@ class UserManagerTest { ClientHandshake handshake; @BeforeEach - void beforeEach() { + void beforeEach() + throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { connection = mock(WebSocket.class); - // when(connection.hashCode()).thenReturn(1); // just for testing, of course - manager = spy(new UserManager()); + + var constructor = UserManager.class.getDeclaredConstructor(); + constructor.setAccessible(true); + manager = spy(constructor.newInstance()); handshake = mock(ClientHandshake.class); when(handshake.getResourceDescriptor()).thenReturn("/someDescriptor");