Ver Fonte

更新单元测试中请求url的前缀&更新pom.xml

UsagiHao há 5 anos atrás
pai
commit
e3af5fbfd8

+ 1 - 6
pom.xml

@@ -76,12 +76,7 @@
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
+            <version>4.13.2</version>
         </dependency>
     </dependencies>
 

+ 3 - 3
src/test/java/cn/seecoder/courselearning/controller/UserControllerTest.java

@@ -58,7 +58,7 @@ public class UserControllerTest {
         userFormVO.setPassword(password);
         String requestJson = ow.writeValueAsString(userFormVO);
 
-        mockMvc.perform(post("/user/login")
+        mockMvc.perform(post("/api/user/login")
                 .contentType(MediaType.APPLICATION_JSON).content(requestJson))
                 .andExpect(MockMvcResultMatchers.status().isOk())
                 .andExpect(MockMvcResultMatchers.content()
@@ -85,7 +85,7 @@ public class UserControllerTest {
         ObjectMapper mapper = new ObjectMapper();
         ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter();
 
-        mockMvc.perform(get("/user/2")
+        mockMvc.perform(get("/api/user/2")
                 .contentType(MediaType.APPLICATION_JSON))
                 .andExpect(MockMvcResultMatchers.status().isOk())
                 .andExpect(MockMvcResultMatchers.content()
@@ -113,7 +113,7 @@ public class UserControllerTest {
         rechargeOrderVO.setCreateTime(new Date());
         String requestJson = ow.writeValueAsString(rechargeOrderVO);
 
-        mockMvc.perform(post("/user/recharge")
+        mockMvc.perform(post("/api/user/recharge")
                 .contentType(MediaType.APPLICATION_JSON).content(requestJson))
                 .andExpect(MockMvcResultMatchers.status().isOk())
                 .andExpect(jsonPath("$.msg", is("充值成功")));