簡體   English   中英

mvn 測試失敗,但從 IntelliJ IDEA 運行測試通過

[英]mvn test fails but running the test from IntelliJ IDEA pass

我有這個我運行的測試

@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 運行它時,測試不會失敗

如果您的項目中有任何測試用例發現它會運行,您可以編寫完整的命令

mvn clean install

如果你想禁用運行測試用例

mvn clean install -Dmaven.test.skip=true

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM