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 --- shared/src/test/scala/FormatTests.scala | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 shared/src/test/scala/FormatTests.scala (limited to 'shared/src/test/scala/FormatTests.scala') diff --git a/shared/src/test/scala/FormatTests.scala b/shared/src/test/scala/FormatTests.scala new file mode 100644 index 0000000..0f56091 --- /dev/null +++ b/shared/src/test/scala/FormatTests.scala @@ -0,0 +1,19 @@ +package spray.json + +import org.scalatest._ + +trait FormatTests { self: FlatSpec => + + def checkRoundtrip[A: RootJsonFormat](a: A, expectedJson: String) = { + it should "serialize to the expected JSON value" in { + val expected: JsValue = expectedJson.parseJson + assert(a.toJson == expected) + } + + it should "serialize then deserialize back to itself" in { + val reread = a.toJson.convertTo[A] + assert(reread == a) + } + } + +} -- cgit v1.2.3