mvn test fails but running the test from IntelliJ IDEA pass
问题 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