-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Milestone
Description
After upgrading from 5.10.2 to 5.11.0 a org.junit.jupiter.api.extension.TestWatcher can no longer access store data. Instead, it now fails with org.junit.jupiter.api.extension.ExtensionContextException: A NamespacedHierarchicalStore cannot be modified or queried after it has been closed.
In my mind the intention of the store is to allow extensions to attach data to the context, so this data should be accessible at least until all extensions related to the context are processed.
Steps to reproduce
import org.junit.jupiter.api.extension.BeforeTestExecutionCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.TestWatcher;
class Mock extends TestCase.Handling<TestCase<?, ?>> implements BeforeTestExecutionCallback, TestWatcher {
static final ExtensionContext.Namespace PACKAGE_PRIVATE = ExtensionContext.Namespace.create(new Object());
@Override
public void beforeTestExecution(ExtensionContext context) throws Exception {
ExtensionContext.Store store = context.getStore(PACKAGE_PRIVATE);
store.put("value", new Object());
}
@Override
public void testSuccessful(ExtensionContext context) {
ExtensionContext.Store store = context.getStore(PACKAGE_PRIVATE);
store.get("value");
}
}Context
- Used versions (Jupiter/Vintage/Platform): 5.11.0
- Build Tool/IDE: maven 3