I converted my eclipse project into a maven project. I have following files in the test part of the project:
The TestException
is an Exception
class that us used in cases where exception should be thrown (it makes sense in this project). MultiResults
and TestSyncPromise
are the actual classes containing JUnit tests.
When select Run as -> 9 Maven test
I get the following output:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.811 s
[INFO] Finished at: 2018-12-10T20:04:45+01:00
[INFO] Final Memory: 21M/197M
[INFO] ------------------------------------------------------------------------
When I instead select Run as -> JUnit test
, the correct files are interpreted as tests.
This is what I've put into my pom.xml
:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<junit.jupiter.version>5.0.0-M4</junit.jupiter.version>
<junit.platform.version>1.0.0-M4</junit.platform.version>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
How do I tell Maven which files are tests and which are just utility classes?