mirror of https://gitee.com/dromara/sms4j.git
删除没用到的依赖指定,删除报错的单元测试
This commit is contained in:
parent
17aa4a63d8
commit
af7f459af8
4
pom.xml
4
pom.xml
|
@ -54,11 +54,7 @@
|
|||
<spring.boot.version>2.7.11</spring.boot.version>
|
||||
<solon.version>2.2.0</solon.version>
|
||||
<redisson.version>3.17.0</redisson.version>
|
||||
<aliyun.version>2.0.23</aliyun.version>
|
||||
<tencent.version>3.1.622</tencent.version>
|
||||
<unisms.version>0.0.4</unisms.version>
|
||||
<jdcloud.version>1.3.3</jdcloud.version>
|
||||
<okhttp.version>3.14.9</okhttp.version>
|
||||
<forest.version>1.5.30</forest.version>
|
||||
<hutool.version>5.8.18</hutool.version>
|
||||
<xmlblend.version>2.3.0</xmlblend.version>
|
||||
|
|
|
@ -2,46 +2,42 @@ package org.dromara.sms4j.example;
|
|||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.sms4j.api.entity.SmsResponse;
|
||||
import org.dromara.sms4j.comm.utils.SmsUtil;
|
||||
import org.dromara.sms4j.core.config.SupplierFactory;
|
||||
import org.dromara.sms4j.core.factory.SmsFactory;
|
||||
import org.dromara.sms4j.provider.enumerate.SupplierType;
|
||||
import org.dromara.sms4j.unisms.config.UniConfig;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@Slf4j
|
||||
@SpringBootTest
|
||||
class Sms4jTest {
|
||||
public static final String USER_AGENT = "uni-java-sdk" + "/0.0.4";
|
||||
|
||||
@Test
|
||||
public void uniSmsTest() {
|
||||
UniConfig build = UniConfig.builder()
|
||||
.signature("洙旭阁")
|
||||
.accessKeyId("7Cr1ZaQVJQ11Ap4HBQMo7xmFg")
|
||||
.templateId("2001")
|
||||
.templateName("message")
|
||||
.isSimple(true)
|
||||
.build();
|
||||
SupplierFactory.setUniConfig(build);
|
||||
|
||||
SmsResponse smsResponse = SmsFactory.createSmsBlend(SupplierType.UNI_SMS).sendMessage("17531165952", "123123");
|
||||
System.out.println(smsResponse);
|
||||
// UniResponse sms = UniSMS.buildMessage().setTo("17531165952").setSignature("洙旭阁").setTemplateId("2001").setTemplateData(map).send();
|
||||
// System.out.println(sms);
|
||||
// Uni.getClient().request("sms.message.send",mes)
|
||||
// UniClient.request()
|
||||
}
|
||||
/**
|
||||
* 填测试手机号
|
||||
*/
|
||||
private static final String PHONE = "";
|
||||
|
||||
@Test
|
||||
public void alibabaSmsTest() {
|
||||
String phone = "";
|
||||
if (StrUtil.isBlank(phone)) {
|
||||
if (StrUtil.isBlank(PHONE)) {
|
||||
return;
|
||||
}
|
||||
SmsResponse smsResponse = SmsFactory.createSmsBlend(SupplierType.ALIBABA).sendMessage(phone, SmsUtil.getRandomInt(6));
|
||||
SmsResponse smsResponse = SmsFactory.createSmsBlend(SupplierType.ALIBABA).sendMessage(PHONE, SmsUtil.getRandomInt(6));
|
||||
log.info(JSONUtil.toJsonStr(smsResponse));
|
||||
Assert.isTrue("OK".equals(smsResponse.getCode()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void huaweiSmsTest() {
|
||||
if (StrUtil.isBlank(PHONE)) {
|
||||
return;
|
||||
}
|
||||
SmsResponse smsResponse = SmsFactory.createSmsBlend(SupplierType.HUAWEI).sendMessage(PHONE, SmsUtil.getRandomInt(6));
|
||||
log.info(JSONUtil.toJsonStr(smsResponse));
|
||||
Assert.isTrue("000000".equals(smsResponse.getCode()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue