Skip to content

Instantly share code, notes, and snippets.

@joeRinehart
Last active December 5, 2017 16:55
Show Gist options
  • Save joeRinehart/ab447d0bc0f35035c994e036f9257af3 to your computer and use it in GitHub Desktop.
Save joeRinehart/ab447d0bc0f35035c994e036f9257af3 to your computer and use it in GitHub Desktop.
Test in Groovy+Spock vs Java
def "Should return 200 when sending request to controller"() {
when:
ResponseEntity<Map> entity = testRestTemplate.getForEntity("http://localhost:" + this.port + "/hello-world", Map.class)
then:
entity.statusCode == HttpStatus.OK
}
@Test
void shouldReturn200WhenSendingRequestToController() {
ResponseEntity<Map> entity = this.testRestTemplate.getForEntity("http://localhost:" + this.port + "/hello-world", Map.class);
then(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment