Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.