| @@ -43,6 +43,7 @@ import tk.mybatis.mapper.entity.Example; | |||||
| import javax.annotation.Resource; | import javax.annotation.Resource; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.HashMap; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| @@ -173,4 +174,25 @@ public class WebTest { | |||||
| log.info("respMap -> {}", JSON.toJSONString(respMap)); | log.info("respMap -> {}", JSON.toJSONString(respMap)); | ||||
| } | } | ||||
| @Test | |||||
| public void add() throws Exception { | |||||
| Map<String, Object> params = new HashMap<>(); | |||||
| params.put("creditNum", "1"); | |||||
| params.put("creditType", "12"); | |||||
| params.put("cuserId", "329879374400159744"); | |||||
| params.put("operatorType", "4"); | |||||
| MvcResult result = mockMvc.perform( | |||||
| MockMvcRequestBuilders.post("/wxCreditHistory/add") | |||||
| .contentType(MediaType.APPLICATION_JSON_UTF8) | |||||
| .content(JSON.toJSONString(params)) | |||||
| ) | |||||
| .andExpect(MockMvcResultMatchers.status().isOk()) | |||||
| .andDo(MockMvcResultHandlers.print()) | |||||
| .andReturn(); | |||||
| String responseStr = result.getResponse().getContentAsString(); | |||||
| ObjectMapper mapper = new ObjectMapper(); | |||||
| Map<String, String> respMap = mapper.readValue(responseStr, Map.class); | |||||
| log.info("respMap -> {}", JSON.toJSONString(respMap)); | |||||
| } | |||||
| } | } | ||||