aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/FormatTests.scala
diff options
context:
space:
mode:
authorJakob Odersky <jakob@odersky.com>2018-02-14 12:17:15 -0800
committerJakob Odersky <jakob@odersky.com>2018-02-14 12:17:15 -0800
commiteada4c48b3954241e130f5d9b5e7feebe8c1e3f2 (patch)
treed017b30fb264b0560cbf7df3540f26e705da8ec0 /src/test/scala/FormatTests.scala
parentaf6845cc08ae223ad67ebad61559d8264fd3346b (diff)
downloadspray-json-derivation-eada4c48b3954241e130f5d9b5e7feebe8c1e3f2.tar.gz
spray-json-derivation-eada4c48b3954241e130f5d9b5e7feebe8c1e3f2.tar.bz2
spray-json-derivation-eada4c48b3954241e130f5d9b5e7feebe8c1e3f2.zip
Prepare for releasing
Diffstat (limited to 'src/test/scala/FormatTests.scala')
-rw-r--r--src/test/scala/FormatTests.scala20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/scala/FormatTests.scala b/src/test/scala/FormatTests.scala
new file mode 100644
index 0000000..e29e49f
--- /dev/null
+++ b/src/test/scala/FormatTests.scala
@@ -0,0 +1,20 @@
+package xyz.driver.json
+
+import spray.json._
+import org.scalatest._
+
+trait FormatTests { self: FlatSpec =>
+
+ def checkCoherence[A: JsonFormat](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)
+ }
+ }
+
+}