Skip to content

Instantly share code, notes, and snippets.

@shinyay
Created September 23, 2021 23:53
Show Gist options
  • Select an option

  • Save shinyay/830897dca65d3118b7186056b5923d19 to your computer and use it in GitHub Desktop.

Select an option

Save shinyay/830897dca65d3118b7186056b5923d19 to your computer and use it in GitHub Desktop.
        val result = mockMvc.perform(get("/api/v1/books/978-4-7710-1067-3"))
            .andDo(MockMvcResultHandlers.print())
            .andExpect(status().isOk)
            .andReturn()
        val javaType = objectMapper.typeFactory.constructCollectionType(List::class.java, Book::class.java)
        val bookObject: List<Book> = objectMapper.readValue(result.response.contentAsString, javaType)
        assertThat(bookObject[0].price).isEqualTo(100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment