test: updated PacketTest with getOriginTest()

This commit is contained in:
Richard Reiber 2021-06-05 20:49:26 +02:00
parent f0bdee28c3
commit 3f14019a83

View File

@ -2,9 +2,11 @@ package uulm.teamname.marvelous.server.lobby.pipelining;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; 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.Request;
import uulm.teamname.marvelous.gamelibrary.requests.RequestBuilder; import uulm.teamname.marvelous.gamelibrary.requests.RequestBuilder;
import uulm.teamname.marvelous.gamelibrary.requests.RequestType; import uulm.teamname.marvelous.gamelibrary.requests.RequestType;
import uulm.teamname.marvelous.server.lobbymanager.Participant;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
import static org.assertj.core.api.Assertions.*; import static org.assertj.core.api.Assertions.*;
@ -39,5 +41,16 @@ class PacketTest {
assertThat(packet).containsOnly(new RequestBuilder(RequestType.Req).buildGameRequest()); 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);
}
} }