【发布时间】:2020-03-15 00:45:42
【问题描述】:
我有一个我在下面运行的测试
@RunWith(SpringRunner.class)
@SpringBootTest
@Test
public void testFind() throws IOException {
Review<Hostel> hostelByComplaintId =
hostelService.findByComplaintId(complaintId).orElse(null);
assertThat(hostelByComplaintId).isNotNull();
}
当我从命令行mvn test 运行测试时,我得到了这个错误
Failed tests:
Expecting actual not to be null
但是当我从 IntelliJ IDEA 运行它时,测试并没有失败
【问题讨论】:
-
如何重现您的问题?请提供minimal, reproducible example。
-
信息不足。盲目猜测:你在终端和 intellij 中使用相同的 maven 版本吗?
标签: java spring spring-boot intellij-idea junit