SecurityV1Controller { @PostMapping(value = "/set_paypwd_status") ResBodyData setPaypwdStatus(@RequestBody @Valid RequestSetPaypwdStatus requestSetPaypwdStatus) { logger.info("收到设置支付密码开关API请求：",requestSetPaypwdStatus.toString()); try { MSMembersGet msMembersGet=new MSMembersGet(); BeanUtils.copyProperties(requestSetPaypwdStatus,msMembersGet); ResBodyData resBodyData = securityService.setPaypwdStatus(msMembersGet); logger.info("设置支付密码开关API请求结果 ：{}",resBodyData.toString()); return resBodyData; } catch (BizException e) { logger.error("设置支付密码开关API请求异常：{}",e.toString()); throw new ApiException(ApiStatusConst.SET_PAYPWD_STATUS_EXCEPTION,ApiStatusConst.getZhMsg(ApiStatusConst.SET_PAYPWD_STATUS_EXCEPTION)); } }  @RequestMapping(value = "/updatememberphone/{token}",method=RequestMethod.PUT) void updatememberphone(@PathVariable String token);  }
@Test public void setPaypwdStatus() throws Exception{ RequestSetPaypwdStatus requestSetPaypwdStatus=new RequestSetPaypwdStatus(); requestSetPaypwdStatus.setMemId(memId); requestSetPaypwdStatus.setEnable("0"); ResultActions postResultAction=mockMvc.perform(MockMvcRequestBuilders.post(baseUrl+"/set_paypwd_status") .contentType(MediaType.APPLICATION_JSON_UTF8) .content(JsonUtils.beanToJson(requestSetPaypwdStatus))) .andExpect(status().isOk()) .andExpect(jsonPath("$.status",is(0))); postResultAction.andDo(new ResultHandler() { @Override public void handle(MvcResult result) throws Exception { logger.info("单元测试>>设置支付密码开关API>>执行结果:{}",result.getResponse().getContentAsString());; } }); }