Skip to content

Instantly share code, notes, and snippets.

@jwalgemoed
Last active December 28, 2017 10:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwalgemoed/66bda2f036b5f569f6d0a1254f03f931 to your computer and use it in GitHub Desktop.
Save jwalgemoed/66bda2f036b5f569f6d0a1254f03f931 to your computer and use it in GitHub Desktop.
fun verify(testRestTemplate: TestRestTemplate) {
val entity = if (request.body != null) {
HttpEntity(request.body, request.headers)
} else {
HttpEntity(request.headers)
}
val actualResponse = testRestTemplate.exchange(request.path, request.method, entity, String::class.java)
Assert.assertEquals("Actual HTTP response code doesn't match expected value.", response.status, actualResponse.statusCode)
assertJsonEquals(response.body, actualResponse.body)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment