From a935a4a9263ec6cd04a7fcea3a09faa349ed2ccc Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Thu, 15 Feb 2018 19:18:34 -0800 Subject: Add another coproduct test --- src/test/scala/CoproductTypeFormats.scala | 9 +++++++-- 1 file 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) + } + } -- cgit v1.2.3