From d27bc6326ccaa77a79434e37cd4b9f5a96b10c7c Mon Sep 17 00:00:00 2001 From: Yannik Bretschneider Date: Wed, 2 Jun 2021 17:51:48 +0200 Subject: [PATCH] test: fixed GameStateSegment test --- .../server/lobby/pipelining/GameStateSegmentTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Server/src/test/java/uulm/teamname/marvelous/server/lobby/pipelining/GameStateSegmentTest.java b/Server/src/test/java/uulm/teamname/marvelous/server/lobby/pipelining/GameStateSegmentTest.java index e5412cd..f2dc4a0 100644 --- a/Server/src/test/java/uulm/teamname/marvelous/server/lobby/pipelining/GameStateSegmentTest.java +++ b/Server/src/test/java/uulm/teamname/marvelous/server/lobby/pipelining/GameStateSegmentTest.java @@ -26,6 +26,7 @@ class GameStateSegmentTest { @Test void processRequests() { var game = mock(GameInstance.class); + var request = new RequestBuilder(RequestType.DisconnectRequest).buildGameRequest(); var event = new EventBuilder(EventType.DisconnectEvent).buildGameEvent(); when(game.checkRequestsAndApply(any(Request.class))).thenReturn(Optional.of(List.of(event))); var abort = new AtomicBoolean(false); @@ -34,7 +35,7 @@ class GameStateSegmentTest { // note that DisconnectRequests are actually never passed to the GameLogic, ever. var packet = new Packet( - new Request[] {new RequestBuilder(RequestType.DisconnectRequest).buildGameRequest()}, + new Request[] {request}, null); var carrier = new ArrayList(1); @@ -42,7 +43,7 @@ class GameStateSegmentTest { segment.processRequests(packet, carrier, abort); assertThat(carrier.contains(event)).isTrue(); - verify(game).checkRequestsAndApply(packet.get(0)); + verify(game).checkRequestsAndApply(request); assertThat(abort.get()).isFalse(); } }