Created
October 22, 2017 18:58
-
-
Save AlexeySoshin/aba55007f545dd47d5356eeb6575b533 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val fionaTheCat = Cat(name="Fiona", age=2.6f, weight=5.3f) | |
@Before | |
fun createCat() { | |
restTemplate.postForLocation("/", HttpEntity(fionaTheCat)) | |
} | |
@Test | |
fun indexShouldReturnSingleCat() { | |
val response = restTemplate.getForEntity("/", CatsList::class.java) | |
assertThat(response.statusCode).isEqualTo(HttpStatus.OK) | |
assertThat(response.body).isNotEmpty | |
assertThat(response.body.size).isEqualTo(1) | |
// We would like to ignore id of the cat here | |
assertThat(response.body[0]).isEqualToComparingOnlyGivenFields(fionaTheCat, "name", "age", "weight") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment