blob: 0f5609113bae965e7d4d98a0b83f0afd55dd311e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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)
}
}
}
|