mirror of https://gitee.com/dromara/sms4j.git
增加测试用例,剔除模板申请临时逻辑
This commit is contained in:
parent
d6c81cdefe
commit
c5da3a642b
|
@ -49,15 +49,6 @@ public class DingZhongSmsImpl extends AbstractSmsBlend<DingZhongConfig> {
|
|||
return SupplierConstant.DINGZHONG;
|
||||
}
|
||||
|
||||
public SmsResponse temp(){
|
||||
DingZhongHelper helper = new DingZhongHelper(getConfig(), http);
|
||||
Map<String, Object> paramMap = new LinkedHashMap<>(3);
|
||||
paramMap.put("cdkey", getConfig().getAccessKeyId());
|
||||
paramMap.put("password", getConfig().getAccessKeySecret());
|
||||
paramMap.put("content", "你正在申请手机注册,验证码为:<%code%>,5分钟内有效!");
|
||||
return helper.smsResponse(paramMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SmsResponse sendMessage(String phone, String message) {
|
||||
DingZhongHelper helper = new DingZhongHelper(getConfig(), http);
|
||||
|
@ -67,12 +58,11 @@ public class DingZhongSmsImpl extends AbstractSmsBlend<DingZhongConfig> {
|
|||
paramMap.put("mobile", phone);
|
||||
paramMap.put("msg", message);
|
||||
return helper.smsResponse(paramMap);
|
||||
//return temp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SmsResponse sendMessage(String phone, LinkedHashMap<String, String> messages) {
|
||||
return sendMessage(phone,getConfig().getTemplateId(),messages);
|
||||
return sendMessage(phone, getConfig().getTemplateId(), messages);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -91,11 +81,11 @@ public class DingZhongSmsImpl extends AbstractSmsBlend<DingZhongConfig> {
|
|||
|
||||
@Override
|
||||
public SmsResponse massTexting(List<String> phones, String message) {
|
||||
return sendMessage(SmsUtils.arrayToString(phones),message);
|
||||
return sendMessage(SmsUtils.arrayToString(phones), message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SmsResponse massTexting(List<String> phones, String templateId, LinkedHashMap<String, String> messages) {
|
||||
return sendMessage(SmsUtils.arrayToString(phones),templateId,messages);
|
||||
return sendMessage(SmsUtils.arrayToString(phones), templateId, messages);
|
||||
}
|
||||
}
|
|
@ -15,6 +15,7 @@ import org.dromara.sms4j.lianlu.service.LianLuSmsImpl;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -254,13 +255,26 @@ class Sms4jTest {
|
|||
|
||||
LinkedHashMap<String, String> messages = new LinkedHashMap<>();
|
||||
messages.put("code", SmsUtils.getRandomInt(6));
|
||||
SmsResponse smsResponse1 = dz.sendMessage(PHONE, messages);
|
||||
log.info(JSONUtil.toJsonStr(smsResponse1));
|
||||
Assert.isTrue(smsResponse1.isSuccess());
|
||||
|
||||
ArrayList<String> phones = new ArrayList<>();
|
||||
phones.add(PHONE);
|
||||
phones.add(PHONE);
|
||||
|
||||
SmsResponse smsResponse = dz.sendMessage(PHONE, "测试短信" + SmsUtils.getRandomInt(6));
|
||||
log.info(JSONUtil.toJsonStr(smsResponse));
|
||||
Assert.isTrue(smsResponse.isSuccess());
|
||||
|
||||
SmsResponse smsResponse1 = dz.sendMessage(PHONE, messages);
|
||||
log.info(JSONUtil.toJsonStr(smsResponse1));
|
||||
Assert.isTrue(smsResponse1.isSuccess());
|
||||
|
||||
SmsResponse smsResponse3 = dz.massTexting(phones, "测试短信" + SmsUtils.getRandomInt(6));
|
||||
log.info(JSONUtil.toJsonStr(smsResponse3));
|
||||
Assert.isTrue(smsResponse3.isSuccess());
|
||||
|
||||
SmsResponse smsResponse4 = dz.massTexting(phones, "527551147741814784" ,messages);
|
||||
log.info(JSONUtil.toJsonStr(smsResponse4));
|
||||
Assert.isTrue(smsResponse4.isSuccess());
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue