Skip to content

Instantly share code, notes, and snippets.

@upkarlidder
Created December 27, 2016 22:55
Show Gist options
  • Select an option

  • Save upkarlidder/0aed88978f57f8f36606f8ab834944b4 to your computer and use it in GitHub Desktop.

Select an option

Save upkarlidder/0aed88978f57f8f36606f8ab834944b4 to your computer and use it in GitHub Desktop.
@Test
public void getAllBooksShouldReturnListOfAllBooks() throws Exception {
final String expectedTitle = "The Lightning Thief";
mockMvc.perform(get(baseUrl + getAllBooksURL)
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(jsonPath("$", hasSize(5)))
.andExpect(jsonPath("$[0].title", is(expectedTitle)));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment