Skip to content

Upgrading to JUnit 5.11

Sam Brannen edited this page Apr 21, 2024 · 4 revisions

This page provides guidance on upgrading to JUnit 5.11.

Field and method search algorithms now adhere to standard Java semantics regarding whether a given field or method is visible or overridden according to the rules of the Java language. See the new Field and Method Search Semantics section of the User Guide for details.

This results in the following change in behavior.

  • Fields no longer hide fields from super types.
    • This applies to non-static as well as static fields (@TempDir, @RegisterExtension, etc.).
  • Methods no longer hide methods from super types unless a given method literally overrides the other method.
    • This applies to non-static as well as static methods (@BeforeAll, @BeforeEach, @Test, etc.).
  • Extensions may have to revise their search algorithms for fields and methods.