mvn test fails but running the test from IntelliJ IDEA pass

て烟熏妆下的殇ゞ 提交于 2021-02-11 18:10:39

问题


I have this a test that I run under

@RunWith(SpringRunner.class)
@SpringBootTest

@Test
    public void testFind() throws IOException {


Review<Hostel> hostelByComplaintId =
                hostelService.findByComplaintId(complaintId).orElse(null);

        assertThat(hostelByComplaintId).isNotNull();
}

when I run the test from the command line mvn test I got this error

Failed tests:
Expecting actual not to be null

but when I run it from IntelliJ IDEA, the test does not fail


回答1:


You can just write complete command if there any test cases in your project found it will run

mvn clean install

if you want to disable run test cases

mvn clean install -Dmaven.test.skip=true


来源:https://stackoverflow.com/questions/58935046/mvn-test-fails-but-running-the-test-from-intellij-idea-pass

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!