|
12 | 12 | import me.chanjar.weixin.cp.bean.message.WxCpLinkedCorpMessage;
|
13 | 13 | import me.chanjar.weixin.cp.bean.message.WxCpMessage;
|
14 | 14 | import me.chanjar.weixin.cp.bean.message.WxCpMessageSendResult;
|
| 15 | +import me.chanjar.weixin.cp.bean.message.WxCpMessageSendStatistics; |
15 | 16 | import org.testng.annotations.AfterTest;
|
16 | 17 | import org.testng.annotations.BeforeTest;
|
17 | 18 | import org.testng.annotations.Guice;
|
|
20 | 21 | import static com.github.dreamhead.moco.Moco.file;
|
21 | 22 | import static com.github.dreamhead.moco.MocoJsonRunner.jsonHttpServer;
|
22 | 23 | import static me.chanjar.weixin.cp.api.ApiTestModuleWithMockServer.mockServerPort;
|
| 24 | +import static org.assertj.core.api.Assertions.assertThat; |
23 | 25 | import static org.testng.Assert.assertNotNull;
|
24 | 26 |
|
25 | 27 | /**
|
|
29 | 31 | * @date 2020-08-30
|
30 | 32 | */
|
31 | 33 | @Test
|
32 |
| -@Guice(modules = ApiTestModuleWithMockServer.class) |
33 |
| -//@Guice(modules = ApiTestModule.class) |
| 34 | +//@Guice(modules = ApiTestModuleWithMockServer.class) |
| 35 | +@Guice(modules = ApiTestModule.class) |
34 | 36 | public class WxCpMessageServiceImplTest {
|
35 | 37 | @Inject
|
36 | 38 | protected WxCpService wxService;
|
@@ -154,11 +156,24 @@ public void testSendMessage_miniProgram_notice() throws WxErrorException {
|
154 | 156 | }
|
155 | 157 |
|
156 | 158 | @Test
|
157 |
| - public void testLinkedCorpMessageSend() throws WxErrorException { |
| 159 | + public void testSendLinkedCorpMessage() throws WxErrorException { |
158 | 160 | this.wxService.getMessageService().sendLinkedCorpMessage(WxCpLinkedCorpMessage.builder()
|
159 | 161 | .msgType(WxConsts.KefuMsgType.TEXT)
|
160 | 162 | .toUsers(new String[]{configStorage.getUserId()})
|
161 | 163 | .content("欢迎欢迎,热烈欢迎\n换行测试\n超链接:<a href=\"http://www.baidu.com\">Hello World</a>")
|
162 | 164 | .build());
|
163 | 165 | }
|
| 166 | + |
| 167 | + @Test |
| 168 | + public void testSend() { |
| 169 | + // see other test methods |
| 170 | + } |
| 171 | + |
| 172 | + @Test |
| 173 | + public void testGetStatistics() throws WxErrorException { |
| 174 | + final WxCpMessageSendStatistics statistics = this.wxService.getMessageService().getStatistics(1); |
| 175 | + assertNotNull(statistics); |
| 176 | + assertThat(statistics.getStatistics()).isNotNull(); |
| 177 | + } |
| 178 | + |
164 | 179 | }
|
0 commit comments