assertThat(response.statusCode, equalTo(403))
assertThat(response.statusText, equalTo("Forbidden"))
assertThat(response.contentType, equalTo("application/json"))
- assertThat(outputStream.toString("UTF-8"), equalTo("{\"success\":false,\"error\":\"auth-required\"}"))
+ assertThat(outputStream.toString("UTF-8").asJson(), equalTo(mapOf("success" to false, "error" to "auth-required")))
}
@Test
assertThat(response.statusCode, equalTo(403))
assertThat(response.statusText, equalTo("Forbidden"))
assertThat(response.contentType, equalTo("application/json"))
- assertThat(outputStream.toString("UTF-8"), equalTo("{\"success\":false,\"error\":\"auth-required\"}"))
+ assertThat(outputStream.toString("UTF-8").asJson(), equalTo(mapOf("success" to false, "error" to "auth-required")))
}
@Test
assertThat(response.statusCode, equalTo(403))
assertThat(response.statusText, equalTo("Forbidden"))
assertThat(response.contentType, equalTo("application/json"))
- assertThat(outputStream.toString("UTF-8"), equalTo("{\"success\":false,\"error\":\"auth-required\"}"))
+ assertThat(outputStream.toString("UTF-8").asJson(), equalTo(mapOf("success" to false, "error" to "auth-required")))
}
@Test
assertThat(response.statusCode, equalTo(200))
assertThat(response.statusText, equalTo("OK"))
assertThat(response.contentType, equalTo("application/json"))
- assertThat(outputStream.toString("UTF-8"), equalTo("{\"success\":true,\"foo\":\"bar\"}"))
+ assertThat(outputStream.toString("UTF-8").asJson(), equalTo(mapOf("success" to true, "foo" to "bar")))
}
@Test
assertThat(response.statusCode, equalTo(403))
assertThat(response.statusText, equalTo("Forbidden"))
assertThat(response.contentType, equalTo("application/json"))
- assertThat(outputStream.toString("UTF-8"), equalTo("{\"success\":false,\"error\":\"auth-required\"}"))
+ assertThat(outputStream.toString("UTF-8").asJson(), equalTo(mapOf("success" to false, "error" to "auth-required")))
}
@Test
assertThat(response.statusCode, equalTo(200))
assertThat(response.statusText, equalTo("OK"))
assertThat(response.contentType, equalTo("application/json"))
- assertThat(outputStream.toString("UTF-8"), equalTo("{\"success\":true,\"foo\":\"bar\"}"))
+ assertThat(outputStream.toString("UTF-8").asJson(), equalTo(mapOf("success" to true, "foo" to "bar")))
}
@Test
assertThat(page.isPrefixPage, equalTo(false))
}
+ private fun String.asJson() = objectMapper.readValue(this, Map::class.java) as Map<String, Any>
+
}