Skip to content

Instantly share code, notes, and snippets.

@roshanadh
Last active October 21, 2022 18:10
Show Gist options
  • Save roshanadh/9bfe40594ca273d3bd2be0f545d5da3a to your computer and use it in GitHub Desktop.
Save roshanadh/9bfe40594ca273d3bd2be0f545d5da3a to your computer and use it in GitHub Desktop.
Testing GET /batteries
@Test
void shouldReturnAllBatteries() throws Exception {
mockMvc
.perform(get("/batteries/"))
.andDo(print())
.andExpect(status().isOk())
.andExpect(jsonPath("$").isArray())
.andExpect(jsonPath("$", Matchers.hasSize(H2Bootstrap.mockBatteries.size())));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment