Skip to content

Commit ba2ed9d

Browse files
committed
Switch to JUnit 5 as default test framework.
1 parent 092c0b8 commit ba2ed9d

2 files changed

Lines changed: 72 additions & 10 deletions

File tree

parent_toplevel/changes.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd">
2424
<body>
2525

26-
<release version="1.0.10" date="not released">
26+
<release version="1.1.0" date="not released">
27+
<action type="update" dev="sseifert">
28+
Switch to JUnit 5 as default test framework.
29+
</action>
2730
<action type="update" dev="sseifert">
2831
Update reflow-maven-skin.
2932
</action>

parent_toplevel/pom.xml

Lines changed: 68 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@
8888
<site.url>http://devops.wcm.io</site.url>
8989
<site.deploy.id>ssh-wcm.io</site.deploy.id>
9090
<site.deploy.url />
91+
92+
<!-- junit5 versions -->
93+
<org.junit.jupiter.version>5.0.2</org.junit.jupiter.version>
94+
<org.junit.vintage.version>4.12.2</org.junit.vintage.version>
95+
<org.junit.platform.version>1.0.2</org.junit.platform.version>
96+
97+
<!-- we'll have to switch back to 2.19.1 because JUnit 5 provider is not yet compatbile with surefire 2.20/2.20.1 - see https://github.com/junit-team/junit5-samples/pull/27 -->
98+
<maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>
9199

92100
</properties>
93101

@@ -100,13 +108,25 @@
100108
<scope>test</scope>
101109
</dependency>
102110
<dependency>
103-
<groupId>junit</groupId>
104-
<artifactId>junit</artifactId>
111+
<groupId>org.mockito</groupId>
112+
<artifactId>mockito-core</artifactId>
105113
<scope>test</scope>
106114
</dependency>
107115
<dependency>
108-
<groupId>org.mockito</groupId>
109-
<artifactId>mockito-core</artifactId>
116+
<groupId>org.junit.jupiter</groupId>
117+
<artifactId>junit-jupiter-api</artifactId>
118+
<scope>test</scope>
119+
</dependency>
120+
121+
<!-- Required to run tests in an IDE that bundles an older version - also required for Eclipse 4.7 -->
122+
<dependency>
123+
<groupId>org.junit.platform</groupId>
124+
<artifactId>junit-platform-launcher</artifactId>
125+
<scope>test</scope>
126+
</dependency>
127+
<dependency>
128+
<groupId>org.junit.jupiter</groupId>
129+
<artifactId>junit-jupiter-engine</artifactId>
110130
<scope>test</scope>
111131
</dependency>
112132

@@ -142,17 +162,37 @@
142162
<artifactId>hamcrest-library</artifactId>
143163
<version>1.3</version>
144164
</dependency>
145-
<dependency>
146-
<groupId>junit</groupId>
147-
<artifactId>junit</artifactId>
148-
<version>4.12</version>
149-
</dependency>
150165
<dependency>
151166
<groupId>org.mockito</groupId>
152167
<artifactId>mockito-core</artifactId>
153168
<version>2.13.0</version>
154169
</dependency>
155170

171+
<dependency>
172+
<groupId>org.junit.jupiter</groupId>
173+
<artifactId>junit-jupiter-api</artifactId>
174+
<version>${org.junit.jupiter.version}</version>
175+
</dependency>
176+
177+
<!-- Required when the project contains JUnit 4 tests -->
178+
<dependency>
179+
<groupId>org.junit.vintage</groupId>
180+
<artifactId>junit-vintage-engine</artifactId>
181+
<version>${org.junit.vintage.version}</version>
182+
</dependency>
183+
184+
<!-- Required to run tests in an IDE that bundles an older version - also required for Eclipse 4.7 -->
185+
<dependency>
186+
<groupId>org.junit.platform</groupId>
187+
<artifactId>junit-platform-launcher</artifactId>
188+
<version>${org.junit.platform.version}</version>
189+
</dependency>
190+
<dependency>
191+
<groupId>org.junit.jupiter</groupId>
192+
<artifactId>junit-jupiter-engine</artifactId>
193+
<version>${org.junit.jupiter.version}</version>
194+
</dependency>
195+
156196
</dependencies>
157197
</dependencyManagement>
158198

@@ -272,6 +312,25 @@
272312
</dependencies>
273313
</plugin>
274314

315+
<plugin>
316+
<groupId>org.apache.maven.plugins</groupId>
317+
<artifactId>maven-surefire-plugin</artifactId>
318+
319+
<!-- TODO: move this to global-parent once the surefire-junit5 integration is stable? -->
320+
<dependencies>
321+
<dependency>
322+
<groupId>org.junit.platform</groupId>
323+
<artifactId>junit-platform-surefire-provider</artifactId>
324+
<version>${org.junit.platform.version}</version>
325+
</dependency>
326+
<dependency>
327+
<groupId>org.junit.jupiter</groupId>
328+
<artifactId>junit-jupiter-engine</artifactId>
329+
<version>${org.junit.jupiter.version}</version>
330+
</dependency>
331+
</dependencies>
332+
</plugin>
333+
275334
</plugins>
276335

277336
</pluginManagement>

0 commit comments

Comments
 (0)