diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java index 5249743f3424..7ab6145cd76a 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java @@ -25,6 +25,7 @@ *
Implementations must provide a no-args constructor. * * @since 5.0 + * @see #postProcessTestInstance(Object, ExtensionContext) */ @API(Experimental) public interface TestInstancePostProcessor extends Extension { @@ -32,6 +33,12 @@ public interface TestInstancePostProcessor extends Extension { /** * Callback for post-processing the supplied test instance. * + *
Note: the {@code ExtensionContext} supplied to a + * {@code TestInstancePostProcessor} will always return an empty + * {@link java.util.Optional} value from {@link ExtensionContext#getTestInstance() + * getTestInstance()}. A {@code TestInstancePostProcessor} should therefore + * only attempt to process the supplied {@code testInstance}. + * * @param testInstance the instance to post-process; never {@code null} * @param context the current extension context; never {@code null} */