问题
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