Browse Source

【企业微信】【群聊机器人消息推送(来源反馈编号:江西科翔:2022120001)】【测试类】

wuyx 3 years ago
parent
commit
0614729e7b

+ 33 - 0
uas-office-qywx-server/src/test/java/com/usoftchina/uas/office/qywx/MessageTest.java

@@ -0,0 +1,33 @@
+package com.usoftchina.uas.office.qywx;
+
+import com.usoftchina.qywx.sdk.RobMessageSdk;
+import com.usoftchina.qywx.sdk.config.QywxProperties;
+import com.usoftchina.qywx.sdk.dto.SendRobMessageReq;
+//import org.junit.Test;
+
+
+/**
+ * @author yingp
+ * @date 2020/2/21
+ */
+public class MessageTest {
+    private static RobMessageSdk sdk;
+    static {
+        sdk = new RobMessageSdk(new QywxProperties());
+    }
+
+//    @Test
+    public void sendProcessMessage() throws Exception {
+        String text = "消息测试";
+        String[] mentionedList = new String[]{"U0815","@all"};
+        String[] mentionedMobileList = new String[]{"13699876151","@all"};
+        String key="263a7170-3197-4ff5-8a29-be42b646a546";
+        System.out.println("BEGIN  ");
+        try {
+            sdk.send(key,new SendRobMessageReq().text(text,mentionedList,mentionedMobileList));
+        }catch (Exception e){
+            throw e;
+        }
+        System.out.println("END  ");
+    }
+}