From 3f14019a83dd267c6edba0f2ad574405413907f7 Mon Sep 17 00:00:00 2001 From: Richard Reiber Date: Sat, 5 Jun 2021 20:49:26 +0200 Subject: [PATCH] test: updated PacketTest with getOriginTest() --- .../server/lobby/pipelining/PacketTest.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Server/src/test/java/uulm/teamname/marvelous/server/lobby/pipelining/PacketTest.java b/Server/src/test/java/uulm/teamname/marvelous/server/lobby/pipelining/PacketTest.java index e3ea747..5923971 100644 --- a/Server/src/test/java/uulm/teamname/marvelous/server/lobby/pipelining/PacketTest.java +++ b/Server/src/test/java/uulm/teamname/marvelous/server/lobby/pipelining/PacketTest.java @@ -2,9 +2,11 @@ package uulm.teamname.marvelous.server.lobby.pipelining; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import uulm.teamname.marvelous.gamelibrary.messages.ParticipantType; import uulm.teamname.marvelous.gamelibrary.requests.Request; import uulm.teamname.marvelous.gamelibrary.requests.RequestBuilder; import uulm.teamname.marvelous.gamelibrary.requests.RequestType; +import uulm.teamname.marvelous.server.lobbymanager.Participant; import static org.junit.jupiter.api.Assertions.*; import static org.assertj.core.api.Assertions.*; @@ -39,5 +41,16 @@ class PacketTest { assertThat(packet).containsOnly(new RequestBuilder(RequestType.Req).buildGameRequest()); } - //TODO: test getOrigin(); + @Test + void getOriginTest(){ + var requests = new Request[] { + new RequestBuilder(RequestType.Req).buildGameRequest(), + new RequestBuilder(RequestType.MoveRequest).buildGameRequest() + }; + var participant = new Participant(null, ParticipantType.PlayerOne, "PlaerOne"); + packet = new Packet(requests, participant); + + assertThat(packet.getOrigin()).isEqualTo(participant); + } + } \ No newline at end of file