From 5ef502abc058358ec3a329c774bb42b9a7bd106f Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Thu, 8 Mar 2018 16:13:03 -0800 Subject: Don't ake derived formats implicit by default --- src/test/scala/ImplicitDerivedFormatTests.scala | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/test/scala/ImplicitDerivedFormatTests.scala (limited to 'src/test/scala/ImplicitDerivedFormatTests.scala') 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 } } }""" + ) + +} -- cgit v1.2.3