Created
July 31, 2023 10:24
-
-
Save rieckpil/0b5aaf78d307f05d0c4ce8e62c83edce to your computer and use it in GitHub Desktop.
Testing Livetemplates for IntelliJ IDEA
This file contains 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
# mockMvcGet | |
org.springframework.test.web.servlet.MvcResult result = this.mockMvc | |
.perform(org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get($url$) | |
.header(org.springframework.http.HttpHeaders.ACCEPT, org.springframework.http.MediaType.APPLICATION_JSON)) | |
.andExpect(org.springframework.test.web.servlet.result.MockMvcResultMatchers.status().is(200)) | |
.andExpect(org.springframework.test.web.servlet.result.MockMvcResultMatchers.content().contentType(org.springframework.http.MediaType.APPLICATION_JSON)) | |
.andExpect(org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath("$.size()", org.hamcrest.Matchers.is(0))) | |
.andDo(org.springframework.test.web.servlet.result.MockMvcResultHandlers.print()) | |
.andReturn(); | |
# mockMvcPost | |
this.mockMvc | |
.perform(org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post($url$) | |
.contentType(org.springframework.http.MediaType.APPLICATION_JSON) | |
.content(""" | |
{ | |
} | |
""") | |
) | |
.andExpect(org.springframework.test.web.servlet.result.MockMvcResultMatchers.status().isCreated()); | |
# test | |
@org.junit.jupiter.api.Test | |
void $testName$() throws Exception { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment