UserServiceImplTest.java 1.0 KB
Newer Older
Q
qinyingjie 已提交
1 2
package com.kwan.springbootkwan;

Q
qinyingjie 已提交
3
import com.kwan.springbootkwan.entity.MailInfo;
Q
qinyingjie 已提交
4 5
import com.kwan.springbootkwan.entity.User;
import com.kwan.springbootkwan.mapper.UserMapper;
Q
qinyingjie 已提交
6
import com.kwan.springbootkwan.service.ISendMsgHandle;
Q
qinyingjie 已提交
7 8 9 10 11 12 13 14 15 16
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;


@SpringBootTest
public class UserServiceImplTest {

    @Autowired
    private UserMapper userService;
Q
qinyingjie 已提交
17 18
    @Autowired
    private ISendMsgHandle isSendMsgHandle;
Q
qinyingjie 已提交
19 20 21 22 23 24

    @Test
    public void queryAll() {
        User user = userService.selectById(1);
        System.out.println(user);
    }
Q
qinyingjie 已提交
25 26 27 28 29 30 31 32 33 34 35 36

    /**
     * 发邮件
     */
    @Test
    void sendSimpleTextEmail() {
        MailInfo mailInfo = new MailInfo();
        mailInfo.setReceiver(new String[]{"qinyingjie@deepexi.com"});
        mailInfo.setSubject("测试主题");
        mailInfo.setContent("邮件内容");
        isSendMsgHandle.sendSimpleTextEmail(mailInfo);
    }
Q
qinyingjie 已提交
37
}