|
@@ -1,11 +1,12 @@
|
|
|
package me.chanjar.weixin.cp.api;
|
|
|
|
|
|
+import org.testng.annotations.*;
|
|
|
+
|
|
|
import com.google.inject.Inject;
|
|
|
import me.chanjar.weixin.common.api.WxConsts;
|
|
|
import me.chanjar.weixin.common.error.WxErrorException;
|
|
|
import me.chanjar.weixin.cp.bean.WxCpMessage;
|
|
|
import me.chanjar.weixin.cp.bean.WxCpMessageSendResult;
|
|
|
-import org.testng.annotations.*;
|
|
|
|
|
|
import static org.testng.Assert.*;
|
|
|
|
|
@@ -14,7 +15,7 @@ import static org.testng.Assert.*;
|
|
|
* @author Daniel Qian
|
|
|
*
|
|
|
*/
|
|
|
-@Test(groups = "customMessageAPI")
|
|
|
+@Test
|
|
|
@Guice(modules = ApiTestModule.class)
|
|
|
public class WxCpMessageAPITest {
|
|
|
|
|
@@ -59,4 +60,32 @@ public class WxCpMessageAPITest {
|
|
|
System.out.println(messageSendResult.getInvalidUserList());
|
|
|
System.out.println(messageSendResult.getInvalidTagList());
|
|
|
}
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testSendMessage_markdown() throws WxErrorException {
|
|
|
+ WxCpMessage message = WxCpMessage
|
|
|
+ .MARKDOWN()
|
|
|
+ .toUser(configStorage.getUserId())
|
|
|
+ .content("您的会议室已经预定,稍后会同步到`邮箱` \n" +
|
|
|
+ " >**事项详情** \n" +
|
|
|
+ " >事 项:<font color=\\\"info\\\">开会</font> \n" +
|
|
|
+ " >组织者:@miglioguan \n" +
|
|
|
+ " >参与者:@miglioguan、@kunliu、@jamdeezhou、@kanexiong、@kisonwang \n" +
|
|
|
+ " > \n" +
|
|
|
+ " >会议室:<font color=\\\"info\\\">广州TIT 1楼 301</font> \n" +
|
|
|
+ " >日 期:<font color=\\\"warning\\\">2018年5月18日</font> \n" +
|
|
|
+ " >时 间:<font color=\\\"comment\\\">上午9:00-11:00</font> \n" +
|
|
|
+ " > \n" +
|
|
|
+ " >请准时参加会议。 \n" +
|
|
|
+ " > \n" +
|
|
|
+ " >如需修改会议信息,请点击:[修改会议信息](https://work.weixin.qq.com)")
|
|
|
+ .build();
|
|
|
+
|
|
|
+ WxCpMessageSendResult messageSendResult = this.wxService.messageSend(message);
|
|
|
+ assertNotNull(messageSendResult);
|
|
|
+ System.out.println(messageSendResult);
|
|
|
+ System.out.println(messageSendResult.getInvalidPartyList());
|
|
|
+ System.out.println(messageSendResult.getInvalidUserList());
|
|
|
+ System.out.println(messageSendResult.getInvalidTagList());
|
|
|
+ }
|
|
|
}
|