Created
January 22, 2022 20:25
-
-
Save httpmurilo/43165e9b53292171def2aa7013e91b63 to your computer and use it in GitHub Desktop.
ControllerCustomerTests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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