test: fixed GameStateSegment test
This commit is contained in:
parent
50bd0f2a19
commit
d27bc6326c
@ -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<Event>(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();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user