Skip to content

Commit c365d99

Browse files
author
zhouweixu
committed
修改请求接口路径
1 parent 7418819 commit c365d99

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

source-code/bean-validation-demo/src/test/java/com/example/beanvalidationdemo/PersonControllerTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void should_check_person_value() throws Exception {
4242
.classId("82938390")
4343
.region("Shanghai")
4444
.phoneNumber("1816313815").build();
45-
mockMvc.perform(post("/api/person")
45+
mockMvc.perform(post("/api/persons")
4646
.contentType(MediaType.APPLICATION_JSON)
4747
.content(objectMapper.writeValueAsString(personRequest)))
4848
.andExpect(MockMvcResultMatchers.jsonPath("sex").value("sex 值不在可选范围"))
@@ -53,15 +53,15 @@ public void should_check_person_value() throws Exception {
5353

5454
@Test
5555
public void should_check_path_variable() throws Exception {
56-
mockMvc.perform(get("/api/person/6")
56+
mockMvc.perform(get("/api/persons/6")
5757
.contentType(MediaType.APPLICATION_JSON))
5858
.andExpect(status().isBadRequest())
5959
.andExpect(content().string("getPersonByID.id: 超过 id 的范围了"));
6060
}
6161

6262
@Test
6363
public void should_check_request_param_value2() throws Exception {
64-
mockMvc.perform(put("/api/person")
64+
mockMvc.perform(put("/api/persons")
6565
.param("name", "snailclimbsnailclimb")
6666
.contentType(MediaType.APPLICATION_JSON))
6767
.andExpect(status().isBadRequest())

0 commit comments

Comments
 (0)