fix: fixed bugs in RequestDeserializer, and wrote Proptests for it

This commit is contained in:
2021-05-28 16:20:40 +02:00
parent da1d72d61a
commit a25231fb3e
2 changed files with 125 additions and 4 deletions

View File

@ -43,7 +43,9 @@ public class RequestDeserializer extends JsonDeserializer<Request> {
.withTargetEntity(unwrap(node, "targetEntity", EntityID.class))
.withOriginField(unwrap(node, "originField", IntVector2.class))
.withTargetField(unwrap(node, "targetField", IntVector2.class))
.withStoneType(unwrap(node, "stoneType", StoneType.class));
.withStoneType(Optional.ofNullable(unwrap(node, "stoneType", EntityID.class))
.map(x -> StoneType.valueOf(x.id))
.orElseGet(() -> null));
switch (requestType) {
case DisconnectRequest,