From c5fe23594f66225eb18bf4e67472cd80023eb448 Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Thu, 8 Mar 2018 16:53:44 -0800 Subject: Refactor build to use sbt-crossproject --- .../test/scala/ImplicitDerivedFormatTests.scala | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 shared/src/test/scala/ImplicitDerivedFormatTests.scala (limited to 'shared/src/test/scala/ImplicitDerivedFormatTests.scala') diff --git a/shared/src/test/scala/ImplicitDerivedFormatTests.scala b/shared/src/test/scala/ImplicitDerivedFormatTests.scala new file mode 100644 index 0000000..1d54ae9 --- /dev/null +++ b/shared/src/test/scala/ImplicitDerivedFormatTests.scala @@ -0,0 +1,24 @@ +package 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