单元测试junit,springboot

单元测试junit,springboot,第1张

单元测试junit,springboot

1、导入依赖


    org.projectlombok
    lombok



    org.springframework.boot
    spring-boot-starter-test
    test

2、编写测试

import com.zrar.easyweb.oam.baseTest;
import com.zrar.easyweb.oam.OamApplication;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = OamApplication.class)//springboot应用
@Slf4j//lombok包里的log注解
public class UserServiceTest2{
    @Autowired
    private UserService userService;
    @Test
    public void test1(){
        log.error(userService.passwordStrengthCheck1("123456A@").toString());
    }
}

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/zaji/5712338.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存