rmannibucau commented on a change in pull request #28: URL: https://github.com/apache/openwebbeans/pull/28#discussion_r439826127
########## File path: webbeans-junit5/src/main/java/org/apache/openwebbeans/junit5/internal/CdiExtension.java ########## @@ -104,40 +112,42 @@ public void beforeAll(final ExtensionContext extensionContext) .peek(Supplier::get) .filter(Objects::nonNull) .toArray(Closeable[]::new); + SeContainer container = initializer.initialize(); if (reusable) { - reusableContainer = initializer.initialize(); + reusableContainer = container; Runtime.getRuntime().addShutdownHook(new Thread( () -> doClose(reusableContainer), getClass().getName() + "-shutdown")); } else { - container = initializer.initialize(); + testInstanceContainer = container; } } @Override public void afterAll(final ExtensionContext extensionContext) { - if (container != null) + if (testInstanceContainer != null) { - doClose(container); - container = null; + doClose(testInstanceContainer); + testInstanceContainer = null; } } @Override public void beforeEach(final ExtensionContext extensionContext) { - if (container == null && reusableContainer == null) + final SeContainer container = getContainer(); + if (container == null) Review comment: sadly it is not the case, CdiExtension can be put on a method, directly or indirectly (through another extension annotation) so we must support the case before/afterAll callbacks are bypassed ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org