blob: 68a476539f8cc321aac957c96d1933d895b325a8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
package xyz.driver.json
import spray.json._
import org.scalatest._
trait FormatTests { self: FlatSpec =>
def checkCoherence[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)
}
}
}
|