Skip to content

Instantly share code, notes, and snippets.

@httpmurilo
Created January 22, 2022 20:25
Show Gist options
  • Save httpmurilo/43165e9b53292171def2aa7013e91b63 to your computer and use it in GitHub Desktop.
Save httpmurilo/43165e9b53292171def2aa7013e91b63 to your computer and use it in GitHub Desktop.
ControllerCustomerTests
@Order(1)
@Test
void testPostAction() throws Exception {
mvc.perform(MockMvcRequestBuilders
.post("/customer")
.content(jsonString(new Customer("Antony", 12, true)))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated());
}
@Test
void testGetAction() throws Exception {
mvc.perform(get("/customer")).andExpect(status().isOk());
}
@Test
void testDeleteAction() throws Exception {
mvc.perform(MockMvcRequestBuilders.delete("/customer/{id}", 1))
.andExpect(status().isNoContent());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment