import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.junit.jupiter.MockitoExtension;
import static org.junit.jupiter.api.Assertions.*;
@ExtendWith(MockitoExtension.class)
public class CheckStatusTest {
@InjectMocks
private CheckStatus checkStatus;
@Test
public void testIsSupported() {
boolean isSupported;
for (Status status : Status.values()) {
isSupported = checkStatus.isSupported(status, false);
if (Status.STATUS_DELIVERED.equals(status)) {
assertTrue(isSupported);
} else {
assertFalse(isSupported);
}
}
}
}
In here the tests are passing in intellij test runner but failing when running
mvn test or mvn clean install
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
packages
The test is for a simple method which returns true if status is delivered
The test is running when using intellij runner and failing when running mvn test or mvn clean install
mvn version – 3.9.6 (plugin of intellij)
jdk – corretto-1.8.0_412 (Installed using intellij)
New contributor
Ayush Saxena is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.