test: adjusted test to reflect actual requirements

This commit is contained in:
Yannik Bretschneider 2021-06-08 02:05:37 +02:00
parent 8dd4a4b60f
commit 07ce02b937

View File

@ -4,6 +4,8 @@ import org.junit.jupiter.api.Test;
import uulm.teamname.marvelous.gamelibrary.events.Event;
import uulm.teamname.marvelous.gamelibrary.events.GamestateEvent;
import uulm.teamname.marvelous.gamelibrary.gamelogic.GameInstance;
import uulm.teamname.marvelous.gamelibrary.messages.client.RequestMessage;
import uulm.teamname.marvelous.gamelibrary.messages.server.EventMessage;
import uulm.teamname.marvelous.gamelibrary.requests.Request;
import uulm.teamname.marvelous.gamelibrary.requests.RequestBuilder;
import uulm.teamname.marvelous.gamelibrary.requests.RequestType;
@ -31,6 +33,9 @@ class RequestGameLogicSegmentTest {
var participant = mock(Participant.class);
var packet = new Packet(requests, participant);
var message = new EventMessage();
message.messages = new Event[] {gamestateEvent};
when(game.getGameStateEvent()).thenReturn(gamestateEvent);
AtomicBoolean abort = new AtomicBoolean(false);
@ -38,8 +43,9 @@ class RequestGameLogicSegmentTest {
segment.processRequests(packet, carrier, abort);
assertThat(packet).isEmpty();
assertThat(carrier).containsOnly(gamestateEvent);
assertThat(carrier).isEmpty();
verify(game).getGameStateEvent();
verify(participant).sendMessage(message);
}
}