File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
src/test/scala/tools/jackson/module/scala/deser Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,18 @@ class EitherDeserializerTest extends DeserializerTest with EitherJsonTestSupport
4949 deserialize(s """ {"left":null} """ , typeRef) should be (Left (None ))
5050 }
5151
52+ it should " be able to deserialize right with Some value" in {
53+ val typeRef = new TypeReference [Either [_, Option [String ]]] {}
54+ deserialize(s """ {"r":" $str"} """ , typeRef) should be(Right (Some (str)))
55+ deserialize(s """ {"right":" $str"} """ , typeRef) should be(Right (Some (str)))
56+ }
57+
58+ it should " be able to deserialize left with Some value" in {
59+ val typeRef = new TypeReference [Either [Option [String ], _]] {}
60+ deserialize(s """ {"l":" $str"} """ , typeRef) should be(Left (Some (str)))
61+ deserialize(s """ {"left":" $str"} """ , typeRef) should be(Left (Some (str)))
62+ }
63+
5264 it should " be able to deserialize Right with complex objects" in {
5365 val typeRef = new TypeReference [Either [String , PlainPojoObject ]] {}
5466 deserialize(s """ {"r": ${serialize(obj)}} """ , typeRef) should be (Right (obj))
You can’t perform that action at this time.
0 commit comments