From 78d3fb84d0d9cf34ce5d206df1b312a8f122246e Mon Sep 17 00:00:00 2001 From: Yannik Bretschneider Date: Thu, 3 Jun 2021 23:38:43 +0200 Subject: [PATCH] refactor: changed AssignmentEnum's name to ParticipantType --- .../{AssignmentEnum.java => ParticipantType.java} | 2 +- .../messages/server/GameStructureMessage.java | 4 ++-- .../teamname/marvelous/gamelibrary/json/JSONTest.java | 10 +++------- .../ingame/deserialize/MessageDeserializationTest.java | 2 +- .../ingame/serialize/MessageSerializationTest.java | 2 +- 5 files changed, 8 insertions(+), 12 deletions(-) rename src/main/java/uulm/teamname/marvelous/gamelibrary/messages/{AssignmentEnum.java => ParticipantType.java} (77%) diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/AssignmentEnum.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/ParticipantType.java similarity index 77% rename from src/main/java/uulm/teamname/marvelous/gamelibrary/messages/AssignmentEnum.java rename to src/main/java/uulm/teamname/marvelous/gamelibrary/messages/ParticipantType.java index 307d6d7..e55e1ba 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/AssignmentEnum.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/ParticipantType.java @@ -1,6 +1,6 @@ package uulm.teamname.marvelous.gamelibrary.messages; -public enum AssignmentEnum { +public enum ParticipantType { PlayerOne, PlayerTwo, Spectator diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/GameStructureMessage.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/GameStructureMessage.java index 4461fd5..c4952a5 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/GameStructureMessage.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/messages/server/GameStructureMessage.java @@ -6,7 +6,7 @@ import uulm.teamname.marvelous.gamelibrary.config.CharacterConfig; import uulm.teamname.marvelous.gamelibrary.config.CharacterProperties; import uulm.teamname.marvelous.gamelibrary.config.PartyConfig; import uulm.teamname.marvelous.gamelibrary.config.ScenarioConfig; -import uulm.teamname.marvelous.gamelibrary.messages.AssignmentEnum; +import uulm.teamname.marvelous.gamelibrary.messages.ParticipantType; import uulm.teamname.marvelous.gamelibrary.messages.BasicMessage; import uulm.teamname.marvelous.gamelibrary.messages.MessageType; @@ -28,7 +28,7 @@ public class GameStructureMessage extends BasicMessage { public final MessageType messageType = MessageType.GAME_STRUCTURE; /** The role the client has been assigned to */ - public AssignmentEnum assignment; + public ParticipantType assignment; /** The name of the first player */ public String playerOneName; diff --git a/src/test/java/uulm/teamname/marvelous/gamelibrary/json/JSONTest.java b/src/test/java/uulm/teamname/marvelous/gamelibrary/json/JSONTest.java index 22b5a1a..75ebf64 100644 --- a/src/test/java/uulm/teamname/marvelous/gamelibrary/json/JSONTest.java +++ b/src/test/java/uulm/teamname/marvelous/gamelibrary/json/JSONTest.java @@ -1,10 +1,7 @@ package uulm.teamname.marvelous.gamelibrary.json; import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.*; @@ -19,8 +16,7 @@ import uulm.teamname.marvelous.gamelibrary.events.Event; import uulm.teamname.marvelous.gamelibrary.events.EventBuilder; import uulm.teamname.marvelous.gamelibrary.events.EventType; import uulm.teamname.marvelous.gamelibrary.events.GamestateEvent; -import uulm.teamname.marvelous.gamelibrary.messages.AssignmentEnum; -import uulm.teamname.marvelous.gamelibrary.messages.BasicMessage; +import uulm.teamname.marvelous.gamelibrary.messages.ParticipantType; import uulm.teamname.marvelous.gamelibrary.messages.ErrorMessage; import uulm.teamname.marvelous.gamelibrary.messages.RoleEnum; import uulm.teamname.marvelous.gamelibrary.messages.client.*; @@ -361,7 +357,7 @@ class JSONTest { var message = new GameStructureMessage(); // message.messageType = MessageType.GAME_STRUCTURE; - message.assignment = AssignmentEnum.PlayerOne; + message.assignment = ParticipantType.PlayerOne; message.playerOneName = "Gandalf"; message.playerTwoName = "Bilbo"; message.playerOneCharacters = new CharacterProperties[] {racoon, quicksilver, hulk}; @@ -1071,7 +1067,7 @@ class JSONTest { var message = new GameStructureMessage(); // message.messageType = MessageType.GAME_STRUCTURE; - message.assignment = AssignmentEnum.PlayerOne; + message.assignment = ParticipantType.PlayerOne; message.playerOneName = "Gandalf"; message.playerTwoName = "Bilbo"; message.playerOneCharacters = new CharacterProperties[] {racoon, quicksilver, hulk}; diff --git a/src/test/java/uulm/teamname/marvelous/gamelibrary/json/ingame/deserialize/MessageDeserializationTest.java b/src/test/java/uulm/teamname/marvelous/gamelibrary/json/ingame/deserialize/MessageDeserializationTest.java index 0dedaa3..493fe90 100644 --- a/src/test/java/uulm/teamname/marvelous/gamelibrary/json/ingame/deserialize/MessageDeserializationTest.java +++ b/src/test/java/uulm/teamname/marvelous/gamelibrary/json/ingame/deserialize/MessageDeserializationTest.java @@ -333,7 +333,7 @@ public class MessageDeserializationTest { var message = new GameStructureMessage(); // message.messageType = MessageType.GAME_STRUCTURE; - message.assignment = AssignmentEnum.PlayerOne; + message.assignment = ParticipantType.PlayerOne; message.playerOneName = "Gandalf"; message.playerTwoName = "Bilbo"; message.playerOneCharacters = new CharacterProperties[] {racoon, quicksilver, hulk}; diff --git a/src/test/java/uulm/teamname/marvelous/gamelibrary/json/ingame/serialize/MessageSerializationTest.java b/src/test/java/uulm/teamname/marvelous/gamelibrary/json/ingame/serialize/MessageSerializationTest.java index 5c967b8..8798928 100644 --- a/src/test/java/uulm/teamname/marvelous/gamelibrary/json/ingame/serialize/MessageSerializationTest.java +++ b/src/test/java/uulm/teamname/marvelous/gamelibrary/json/ingame/serialize/MessageSerializationTest.java @@ -345,7 +345,7 @@ public class MessageSerializationTest { var message = new GameStructureMessage(); // message.messageType = MessageType.GAME_STRUCTURE; - message.assignment = AssignmentEnum.PlayerOne; + message.assignment = ParticipantType.PlayerOne; message.playerOneName = "Gandalf"; message.playerTwoName = "Bilbo"; message.playerOneCharacters = new CharacterProperties[] {racoon, quicksilver, hulk};