diff options
author | Jakob Odersky <jakob@odersky.com> | 2018-03-08 16:53:44 -0800 |
---|---|---|
committer | Jakob Odersky <jakob@odersky.com> | 2018-03-28 10:34:31 -0700 |
commit | c5fe23594f66225eb18bf4e67472cd80023eb448 (patch) | |
tree | 58fe8509b3990932134c18e09ed69ee83b779373 /shared/src/test/scala/FormatTests.scala | |
parent | 2f3f9aa851080b6c79f3af14b3fdfeab56feffec (diff) | |
download | spray-json-derivation-c5fe23594f66225eb18bf4e67472cd80023eb448.tar.gz spray-json-derivation-c5fe23594f66225eb18bf4e67472cd80023eb448.tar.bz2 spray-json-derivation-c5fe23594f66225eb18bf4e67472cd80023eb448.zip |
Refactor build to use sbt-crossproject
Diffstat (limited to 'shared/src/test/scala/FormatTests.scala')
-rw-r--r-- | shared/src/test/scala/FormatTests.scala | 19 |
1 files changed, 19 insertions, 0 deletions
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) + } + } + +} |