aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/test/scala/CoproductTypeFormats.scala9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/test/scala/CoproductTypeFormats.scala b/src/test/scala/CoproductTypeFormats.scala
index f9b71b8..cdf0201 100644
--- a/src/test/scala/CoproductTypeFormats.scala
+++ b/src/test/scala/CoproductTypeFormats.scala
@@ -27,8 +27,8 @@ class CoproductTypeFormats
)
"Nested parameter case class child" should behave like checkCoherence[Expr](
- Plus(Value(42), Value(0)),
- """{"type":"Plus","lhs":{"type":"Value","x":42},"rhs":{"type":"Value","x":0}}"""
+ Plus(Value(42), One),
+ """{"type":"Plus","lhs":{"type":"Value","x":42},"rhs":"One"}"""
)
"Case object child" should behave like checkCoherence[Expr](
@@ -54,4 +54,9 @@ class CoproductTypeFormats
"""["A", "B"]"""
)
+ "Serializing as sealed trait an deserializing as child" should "work" in {
+ val expr: Expr = Plus(Value(42), Plus(Zero(), One))
+ assert(expr.toJson.convertTo[Plus] == expr)
+ }
+
}