Junit测试没有守护线程吗,test1方法里 创建的线程没执行完,程序就结束了。
有的,看看这个帖子https://blog.csdn.net/HaHa_Sir/article/details/126923357
@Test
public void test1() {
Thread t = new Thread(() -> {
});
t.setDaemon(true);
t.start();
}
@Test
public void test1() throws InterruptedException {
Thread t = new Thread(() -> {
});
t.start();
t.join();
}