|
1 | 1 | package me.chanjar.weixin.cp.api;
|
2 | 2 |
|
| 3 | +import org.testng.annotations.*; |
| 4 | + |
3 | 5 | import com.google.inject.Inject;
|
4 | 6 | import me.chanjar.weixin.common.api.WxConsts;
|
5 | 7 | import me.chanjar.weixin.common.error.WxErrorException;
|
6 | 8 | import me.chanjar.weixin.cp.bean.WxCpMessage;
|
7 | 9 | import me.chanjar.weixin.cp.bean.WxCpMessageSendResult;
|
8 |
| -import org.testng.annotations.*; |
9 | 10 |
|
10 | 11 | import static org.testng.Assert.*;
|
11 | 12 |
|
|
14 | 15 | * @author Daniel Qian
|
15 | 16 | *
|
16 | 17 | */
|
17 |
| -@Test(groups = "customMessageAPI") |
| 18 | +@Test |
18 | 19 | @Guice(modules = ApiTestModule.class)
|
19 | 20 | public class WxCpMessageAPITest {
|
20 | 21 |
|
@@ -59,4 +60,32 @@ public void testSendMessage1() throws WxErrorException {
|
59 | 60 | System.out.println(messageSendResult.getInvalidUserList());
|
60 | 61 | System.out.println(messageSendResult.getInvalidTagList());
|
61 | 62 | }
|
| 63 | + |
| 64 | + @Test |
| 65 | + public void testSendMessage_markdown() throws WxErrorException { |
| 66 | + WxCpMessage message = WxCpMessage |
| 67 | + .MARKDOWN() |
| 68 | + .toUser(configStorage.getUserId()) |
| 69 | + .content("您的会议室已经预定,稍后会同步到`邮箱` \n" + |
| 70 | + " >**事项详情** \n" + |
| 71 | + " >事 项:<font color=\\\"info\\\">开会</font> \n" + |
| 72 | + " >组织者:@miglioguan \n" + |
| 73 | + " >参与者:@miglioguan、@kunliu、@jamdeezhou、@kanexiong、@kisonwang \n" + |
| 74 | + " > \n" + |
| 75 | + " >会议室:<font color=\\\"info\\\">广州TIT 1楼 301</font> \n" + |
| 76 | + " >日 期:<font color=\\\"warning\\\">2018年5月18日</font> \n" + |
| 77 | + " >时 间:<font color=\\\"comment\\\">上午9:00-11:00</font> \n" + |
| 78 | + " > \n" + |
| 79 | + " >请准时参加会议。 \n" + |
| 80 | + " > \n" + |
| 81 | + " >如需修改会议信息,请点击:[修改会议信息](https://work.weixin.qq.com)") |
| 82 | + .build(); |
| 83 | + |
| 84 | + WxCpMessageSendResult messageSendResult = this.wxService.messageSend(message); |
| 85 | + assertNotNull(messageSendResult); |
| 86 | + System.out.println(messageSendResult); |
| 87 | + System.out.println(messageSendResult.getInvalidPartyList()); |
| 88 | + System.out.println(messageSendResult.getInvalidUserList()); |
| 89 | + System.out.println(messageSendResult.getInvalidTagList()); |
| 90 | + } |
62 | 91 | }
|
0 commit comments