更新 SMSServiceTest.java
parent
fa8595d030
commit
2d3d3aa676
|
|
@ -8,7 +8,8 @@ import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
class SMSServiceTest {
|
class SMSServiceTest {
|
||||||
|
|
@ -35,14 +36,41 @@ class SMSServiceTest {
|
||||||
"【宽带专区】回“9”\n" +
|
"【宽带专区】回“9”\n" +
|
||||||
"【在线客服】若您有话费/流量疑问、业务咨询/退订等其他需求可联系在线文字客服,点击官方认证通道: https://dx.10086.cn/Q_HZBg \n" +
|
"【在线客服】若您有话费/流量疑问、业务咨询/退订等其他需求可联系在线文字客服,点击官方认证通道: https://dx.10086.cn/Q_HZBg \n" +
|
||||||
"【为您推荐】尊敬的客户,您好!您有10元话费券待领取: http://dx.10086.cn/D/jEd1Jq ,点击查看话费使用详情: https://dx.10086.cn/38UvEQ 。。【中国移动】";
|
"【为您推荐】尊敬的客户,您好!您有10元话费券待领取: http://dx.10086.cn/D/jEd1Jq ,点击查看话费使用详情: https://dx.10086.cn/38UvEQ 。。【中国移动】";
|
||||||
|
String shortMsg = "【腾讯科技】尊敬的用户,您的账号whj139****3736,经人工客服核实,已根据账号使用情况进行处理,请重新登录即可。";
|
||||||
|
String superMsg = generateMsg();
|
||||||
|
|
||||||
String accessToken = "gKGCDSgWV82XbU0H";
|
String accessToken = "gKGCDSgWV82XbU0H";
|
||||||
|
List<SMSInfo> smsInfoList = new ArrayList<>();
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
SMSInfo smsInfo = new SMSInfo();
|
SMSInfo smsInfo = new SMSInfo();
|
||||||
smsInfo.setSmsContent(message);
|
smsInfo.setSmsNumber("12321");
|
||||||
smsInfo.setSmsNumber("11111");
|
smsInfo.setSmsAcceptanceTime("1123321");
|
||||||
smsInfo.setSmsAcceptanceTime("11111");
|
smsInfoList.add(smsInfo);
|
||||||
|
}
|
||||||
|
|
||||||
ServerResponseEntity serverResponseEntity = smsService.getSMSInfo(accessToken,smsInfo);
|
smsInfoList.get(0).setSmsContent(message);
|
||||||
|
smsInfoList.get(1).setSmsContent(shortMsg);
|
||||||
|
smsInfoList.get(2).setSmsContent(superMsg);
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
ServerResponseEntity serverResponseEntity = smsService.getSMSInfo(accessToken,smsInfoList.get(i));
|
||||||
logger.info(serverResponseEntity.toString());
|
logger.info(serverResponseEntity.toString());
|
||||||
|
try {
|
||||||
|
Thread.sleep(3000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
private String generateMsg() {
|
||||||
|
StringBuilder msg = new StringBuilder("这是一条超长消息用于测试。");
|
||||||
|
int size = msg.toString().getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
|
||||||
|
|
||||||
|
while (size <= 2100) {
|
||||||
|
msg.append("这是一条超长消息用于测试。");
|
||||||
|
size = msg.toString().getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
|
||||||
|
}
|
||||||
|
|
||||||
|
return msg.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue