### Question:
WxMpTemplateMsgServiceImpl implements WxMpTemplateMsgService { @Override public String sendTemplateMsg(WxMpTemplateMessage templateMessage) throws WxErrorException { String url = "https: String responseContent = this.wxMpService.post(url, templateMessage.toJson()); final JsonObject jsonObject = JSON_PARSER.parse(responseContent).getAsJsonObject(); if (jsonObject.get("errcode").getAsInt() == 0) { return jsonObject.get("msgid").getAsString(); } throw new WxErrorException(WxError.fromJson(responseContent, WxType.MP)); } WxMpTemplateMsgServiceImpl(WxMpService wxMpService); @Override String sendTemplateMsg(WxMpTemplateMessage templateMessage); @Override boolean setIndustry(WxMpTemplateIndustry wxMpIndustry); @Override WxMpTemplateIndustry getIndustry(); @Override String addTemplate(String shortTemplateId); @Override List<WxMpTemplate> getAllPrivateTemplate(); @Override boolean delPrivateTemplate(String templateId); static final String API_URL_PREFIX; }### Answer:
@Test(invocationCount = 5, threadPoolSize = 3) public void testSendTemplateMsg() throws WxErrorException { SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss.SSS"); TestConfigStorage configStorage = (TestConfigStorage) this.wxService .getWxMpConfigStorage(); WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder() .toUser(configStorage.getOpenid()) .templateId(configStorage.getTemplateId()) .url(" ") .build(); templateMessage.addData(new WxMpTemplateData("first", dateFormat.format(new Date()), "#FF00FF")) .addData(new WxMpTemplateData("remark", RandomStringUtils.randomAlphanumeric(100), "#FF00FF")); String msgId = this.wxService.getTemplateMsgService().sendTemplateMsg(templateMessage); Assert.assertNotNull(msgId); System.out.println(msgId); }