3
3
4
4
*Date of Release:* ❓
5
5
6
- *Scope:* Fifth milestone release of JUnit 5 with a focus on dynamic containers and minor
7
- API changes.
6
+ *Scope:* Fifth milestone release of JUnit 5 with a focus on dynamic containers, test
7
+ instance lifecycle management, and minor API changes.
8
8
9
9
WARNING: This is a milestone release and contains breaking changes. Please refer to the
10
10
<<running-tests-ide-intellij-idea,instructions>> above to use this version in a version of
@@ -38,6 +38,7 @@ is placed on the Java 9 module path.
38
38
| `junit-vintage-engine-<VERSION>.jar` | `org.junit.vintage.engine`
39
39
|===
40
40
41
+
41
42
[[release-notes-5.0.0-m5-junit-platform]]
42
43
==== JUnit Platform
43
44
@@ -69,7 +70,7 @@ is placed on the Java 9 module path.
69
70
- `junit-platform-commons`: `ReflectionUtils.findAllClassesInClasspathRoot(Path, Predicate, Predicate)`
70
71
* The `isLeaf()` method of the `org.junit.platform.engine.support.hierarchical.Node`
71
72
interface has been removed.
72
- * The default methods `pruneTree()`, and `hasTests()` have been removed from
73
+ * The default methods `pruneTree()` and `hasTests()` have been removed from
73
74
`TestDescriptor`.
74
75
75
76
===== New Features and Improvements
@@ -94,6 +95,7 @@ is placed on the Java 9 module path.
94
95
* The `ENGINE` enum constant was removed from `TestDescriptor.Type`. The default type of
95
96
the `EngineDescriptor` is now `TestDescriptor.Type.CONTAINER`.
96
97
98
+
97
99
[[release-notes-5.0.0-m5-junit-jupiter]]
98
100
==== JUnit Jupiter
99
101
@@ -116,6 +118,9 @@ is placed on the Java 9 module path.
116
118
the functionality for creating an `Arguments` instance is now available via the
117
119
`Arguments.of(...)` static factory method.
118
120
* The `names` property of `@MethodSource` has been renamed to `value`.
121
+ * The `getTestInstance()` method in the `TestExtensionContext` API has been moved to the
122
+ `ExtensionContext` API. Furthermore, the signature has changed from
123
+ `Object getTestInstance()` to `Optional<Object> getTestInstance()`.
119
124
120
125
[[release-notes-5.0.0-m5-migration-extension-api]]
121
126
.Extension API Migration
@@ -133,6 +138,18 @@ is placed on the Java 9 module path.
133
138
134
139
===== New Features and Improvements
135
140
141
+ * The test instance lifecycle can now be switched from the default per-method mode to a
142
+ new per-class mode via the new class-level `@TestInstance` annotation. This enables
143
+ shared test instance state between test methods in a given test class as well as
144
+ between non-static `@BeforeAll` and `@AfterAll` methods in the test class.
145
+ - See <<writing-tests-test-instance-lifecycle>> for details.
146
+ * `@BeforeAll` and `@AfterAll` methods are no longer required to be `static` if the test
147
+ class is annotated with `@TestInstance(Lifecycle.PER_CLASS)`. This enables the
148
+ following new features.
149
+ - Declaration of `@BeforeAll` and `@AfterAll` methods in `@Nested` test classes.
150
+ - Declaration of `@BeforeAll` and `@AfterAll` on interface `default` methods.
151
+ - Simplified declaration of `@BeforeAll` and `@AfterAll` methods in test classes
152
+ implemented with the Kotlin programming language.
136
153
* `Assertions.assertAll()` now tracks exceptions of any type (as opposed to only tracking
137
154
exceptions of type `AssertionError`), unless the exception is a _blacklisted_ exception
138
155
in which case it will be immediately rethrown.
@@ -149,6 +166,7 @@ is placed on the Java 9 module path.
149
166
* `@TestFactory` now supports arbitrarily nested dynamic containers. See `DynamicContainer`
150
167
and abstract base class `DynamicNode` for details.
151
168
169
+
152
170
[[release-notes-5.0.0-m5-junit-vintage]]
153
171
==== JUnit Vintage
154
172
0 commit comments