diff options
author | Jakob Odersky <jakob@odersky.com> | 2018-02-15 19:18:34 -0800 |
---|---|---|
committer | Jakob Odersky <jakob@odersky.com> | 2018-02-15 19:18:34 -0800 |
commit | a935a4a9263ec6cd04a7fcea3a09faa349ed2ccc (patch) | |
tree | 5915ce3f51a38c49c8a075d35a221df188ab1e69 /src | |
parent | 4e58073b3708e910091ca393edd05ecf96eaa437 (diff) | |
download | spray-json-derivation-a935a4a9263ec6cd04a7fcea3a09faa349ed2ccc.tar.gz spray-json-derivation-a935a4a9263ec6cd04a7fcea3a09faa349ed2ccc.tar.bz2 spray-json-derivation-a935a4a9263ec6cd04a7fcea3a09faa349ed2ccc.zip |
Add another coproduct test
Diffstat (limited to 'src')
-rw-r--r-- | src/test/scala/CoproductTypeFormats.scala | 9 |
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) + } + } |