feat: implemented EntitySerializer and partial test

This commit is contained in:
2021-06-01 00:33:36 +02:00
parent ad9d314b6b
commit bfe7b10169
3 changed files with 123 additions and 0 deletions

View File

@ -0,0 +1,43 @@
package uulm.teamname.marvelous.gamelibrary.json.ingame.serialize;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Test;
import uulm.teamname.marvelous.gamelibrary.IntVector2;
import uulm.teamname.marvelous.gamelibrary.entities.Character;
import uulm.teamname.marvelous.gamelibrary.entities.EntityID;
import uulm.teamname.marvelous.gamelibrary.entities.EntityType;
import uulm.teamname.marvelous.gamelibrary.entities.StoneType;
import uulm.teamname.marvelous.gamelibrary.json.ingame.deserialize.EntityDeserializer;
import static org.mockito.Mockito.*;
import static org.junit.jupiter.api.Assertions.*;
class EntitySerializerTest {
@Test
void notATestJustSomethingToRun() throws JsonProcessingException {
var mapper = new ObjectMapper();
var chara = new Character(
new EntityID(EntityType.P2, 3),
new IntVector2(12, 24),
"CoolHeroThing",
200,
300,
400,
500,
600,
700);
chara.inventory.addStone(StoneType.SoulStone);
chara.inventory.addStone(StoneType.SpaceStone);
chara.inventory.addStone(StoneType.MindStone);
var result = mapper.writeValueAsString(chara);
System.out.println(result);
}
}