feat: implemented NPC serialization properly
This commit is contained in:
@ -12,12 +12,13 @@ import uulm.teamname.marvelous.gamelibrary.json.ingame.deserialize.EntityDeseria
|
||||
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
class EntitySerializerTest {
|
||||
|
||||
|
||||
@Test
|
||||
void notATestJustSomethingToRun() throws JsonProcessingException {
|
||||
void serializeCharacter() throws JsonProcessingException {
|
||||
var mapper = new ObjectMapper();
|
||||
|
||||
var chara = new Character(
|
||||
@ -35,9 +36,21 @@ class EntitySerializerTest {
|
||||
chara.inventory.addStone(StoneType.SpaceStone);
|
||||
chara.inventory.addStone(StoneType.MindStone);
|
||||
|
||||
var result = mapper.writeValueAsString(chara);
|
||||
var jsonRepresentingCharacter = """
|
||||
{
|
||||
"entityType":"Character",
|
||||
"name":"CoolHeroThing",
|
||||
"PID":1,
|
||||
"ID":1,
|
||||
"HP":200,
|
||||
"MP":300,
|
||||
"AP":8,
|
||||
"stones":[1,2,5],
|
||||
"position":[12,24]
|
||||
}""".replace("\n", "");
|
||||
|
||||
System.out.println(result);
|
||||
assertThat(mapper.writeValueAsString(chara))
|
||||
.isEqualTo(jsonRepresentingCharacter);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user