File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
src/test/scala/com/fasterxml/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
49
49
deserialize(s """ {"left":null} """ , typeRef) should be (Left (None ))
50
50
}
51
51
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
+
52
64
it should " be able to deserialize Right with complex objects" in {
53
65
val typeRef = new TypeReference [Either [String , PlainPojoObject ]] {}
54
66
deserialize(s """ {"r": ${serialize(obj)}} """ , typeRef) should be (Right (obj))
You can’t perform that action at this time.
0 commit comments