Skip to content

Document that @BeforeAll & @AfterAll are unsupported in @Nested test classes #88

@sbrannen

Description

@sbrannen

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions