-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Description
Status Quo
Since support for configuring the test instance lifecycle was dropped after the prototype, @BeforeAll
and @AfterAll
methods are now required to be static
. Consequently such methods can no longer be used in @Nested
test classes. Any attempt to do so will result in a compilation error similar to the following.
The method myBeforeAllMethod cannot be declared static; static methods can only be declared in a static or top level type.
See the nested test classes in com.example.HierarchyTestCase
for concrete examples.
Deliverables
- Decide how to handle
@BeforeAll
and@AfterAll
methods in nested test classes.- The team decided that this is simply not supported since the Java language doesn't support it.
- Document that
@BeforeAll
and@AfterAll
are unsupported in nested test classes. - Delete
com.example.HierarchyTestCase
.