diff options
author | Jakob Odersky <jakob@odersky.com> | 2018-03-08 16:13:03 -0800 |
---|---|---|
committer | Jakob Odersky <jakob@odersky.com> | 2018-03-08 16:21:49 -0800 |
commit | 5ef502abc058358ec3a329c774bb42b9a7bd106f (patch) | |
tree | ee5c20fa79307e1a8397a86f31fbe54cbfe9fe1a /src/test/scala/ImplicitDerivedFormatTests.scala | |
parent | eb1ad3c956c828d421b7650dd3b01d5129a41a3d (diff) | |
download | spray-json-derivation-0.3.0.tar.gz spray-json-derivation-0.3.0.tar.bz2 spray-json-derivation-0.3.0.zip |
Don't ake derived formats implicit by defaultv0.3.0
Diffstat (limited to 'src/test/scala/ImplicitDerivedFormatTests.scala')
-rw-r--r-- | src/test/scala/ImplicitDerivedFormatTests.scala | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/scala/ImplicitDerivedFormatTests.scala b/src/test/scala/ImplicitDerivedFormatTests.scala new file mode 100644 index 0000000..9723cb0 --- /dev/null +++ b/src/test/scala/ImplicitDerivedFormatTests.scala @@ -0,0 +1,26 @@ +package xyz.driver.json + +import spray.json._ + +import org.scalatest._ + +class ImplicitDerivedFormatTests + extends FlatSpec + with FormatTests + with ImplicitDerivedFormats + with DefaultJsonProtocol { + + case class B(x: Int, b: String, mp: Map[String, Int]) + case class C(b: B) + + "Simple parameter product" should behave like checkRoundtrip( + B(42, "Hello World", Map("a" -> 1, "b" -> -1024)), + """{ "x": 42, "b": "Hello World", "mp": { "a": 1, "b": -1024 } }""" + ) + + "Nested parameter product with custom child format" should behave like checkRoundtrip( + C(B(42, "Hello World", Map("a" -> 1, "b" -> -1024))), + """{"b" :{ "x": 42, "b": "Hello World", "mp": { "a": 1, "b": -1024 } } }""" + ) + +} |