fix: fixed GamestateEvent deserialization test

This commit is contained in:
Yannik Bretschneider 2021-05-17 18:48:58 +02:00
parent 156677f290
commit c5fe7ec7db

View File

@ -124,30 +124,31 @@ class EventDeserializerTest {
gamestate.winCondition = true; gamestate.winCondition = true;
var jsonRepresentingGamestate = """ var jsonRepresentingGamestate = """
{ {
"eventType": "GamestateEvent", "eventType": "GamestateEvent",
"entities": [ "entities": [
{ {
"entityType": "Character", "entityType": "Character",
"Name": "Alpha", "name": "Alpha",
"PID": 1, "PID": 1,
"ID": 4, "ID": 4,
"HP": 210, "HP": 210,
"MP": 9, "MP": 9,
"AP": 3, "AP": 3,
"Stones": [1, 4], "stones": [1, 4],
"position": [4, 2] "position": [4, 2]
}, },
{ {
"entityType": "Character", "entityType": "Character",
"Name": "Steel Wall", "name": "Steel Wall",
"PID": 1, "PID": 1,
"ID": 4, "ID": 4,
"HP": 123, "HP": 123,
"MP": 2, "MP": 2,
"AP": 21, "AP": 21,
"Stones": [], "stones": [],
"position": [6, 7] "position": [6, 7]
}, },
{ {
@ -182,7 +183,11 @@ class EventDeserializerTest {
} }
"""; """;
assertThat((GamestateEvent) mapper.readValue(jsonRepresentingGamestate, GamestateEvent.class)) System.out.println("=== DEBUG OUTPUT ===\n"
+ mapper.readValue(jsonRepresentingGamestate, Event.class)
+ "\n====================");
assertThat((GamestateEvent) mapper.readValue(jsonRepresentingGamestate, Event.class))
.withFailMessage("GamestateEvent was not properly deserialized") .withFailMessage("GamestateEvent was not properly deserialized")
.isEqualTo(gamestate); .isEqualTo(gamestate);
} }