I'm writing test for some JSON restful API using Scalatra, a snippet looks like following
class MyScalatraServletTests extends ScalatraSuite with FunSuite {
test("An valid request should return 200") {
get ("/rest/json/accc/B1Q4K3/1") {
status should equal (200)
body should include ("TEST")
}
}
}
The body expected is a JSON serialised by Scalatra through its JSON support. My question is how can I convert the body back to the same case class instance in scala, and simplify the test greatly?