测试类编写

This commit is contained in:
2022-01-24 23:52:29 +08:00
parent ca65b5e8fc
commit 0c074c046f
11 changed files with 215 additions and 24 deletions

View File

@@ -12,8 +12,9 @@ public enum NotifyType {
/**
* 邮件类型
*/
MAIL_TYPE("邮件"),
SMS_TYPE("短信");
TYPE_LOG("日志输出"),
TYPE_MAIL("邮件"),
TYPE_MSG("短信");
private final String typeName;

View File

@@ -6,7 +6,6 @@ import com.hxuanyu.notify.service.MailService;
import com.hxuanyu.notify.service.NotifyService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -26,10 +25,12 @@ public class NotifyServiceImpl implements NotifyService {
@Override
public void notify(Object content, NotifyType notifyType) {
if (NotifyType.MAIL_TYPE.equals(notifyType)) {
if (NotifyType.TYPE_MAIL.equals(notifyType)) {
sendMail(content);
} else if (NotifyType.SMS_TYPE.equals(notifyType)) {
} else if (NotifyType.TYPE_MSG.equals(notifyType)) {
sendSms(content);
} else if (NotifyType.TYPE_LOG.equals(notifyType)) {
logger.info("新通知:{}", content);
} else {
logger.info("未匹配到通知类型:[{}]", content);
}