From 0dcbc71127994f6c8d4bba6b9f11755c897488f7 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Thu, 12 Mar 2020 17:57:53 +0100 Subject: [PATCH] Update Javadoc for TestInstancePreDestroyCallback regarding scope --- .../api/extension/TestInstancePreDestroyCallback.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreDestroyCallback.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreDestroyCallback.java index be9c81e8e7c..c7f670d57f3 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreDestroyCallback.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreDestroyCallback.java @@ -23,7 +23,14 @@ * the test instance, invoking custom clean-up methods on the test instance, etc. * *

Extensions that implement {@code TestInstancePreDestroyCallback} must be - * registered at the class level. + * registered at the class level if the test class is configured with + * {@link org.junit.jupiter.api.TestInstance.Lifecycle @TestInstance(Lifecycle.PER_CLASS)} + * semantics. If the test class is configured with + * {@link org.junit.jupiter.api.TestInstance.Lifecycle @TestInstance(Lifecycle.PER_METHOD)} + * semantics, {@code TestInstancePreDestroyCallback} extensions may be registered + * at the class level or at the method level. In the latter case, the + * {@code TestInstancePreDestroyCallback} extension will only be applied to the + * test method for which it is registered. * *

Constructor Requirements

*