I have a test
package ...
...
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
...
import static org.junit.jupiter.api.Assertions.*;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class WebLayerTest {
@Test
public void testSomething() throws ... {
...
and I can run in from Jetbrains IDEA well. Unfortunately, it doesn't work from Maven
mvn test
just doesn't run it, while
mvn test -Dtest=WebLayerTest
swears
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.557 s
[INFO] Finished at: 2022-05-11T13:07:11+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) on project app: No tests were executed! (Set -DfailIfNoTests=false to ignore this error.) -> [Help 1]
Maven version is
> mvn --version
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: D:\Users\myname\apache-maven-3.8.4
Java version: 17.0.2, vendor: Azul Systems, Inc., runtime: D:\Users\myname\.jdks\azul-17.0.2
Default locale: en_US, platform encoding: Cp1252
OS name: "windows server 2016", version: "10.0", arch: "amd64", family: "windows"