philippkunz commented on a change in pull request #28:
URL: https://github.com/apache/openwebbeans/pull/28#discussion_r439843265



##########
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:
       That sounds to me more like the `beforeAll` callback had missed to find 
the `@Cdi` annontation(s) by not looking at the right execution context(s in 
various places up the nesting or inheritance or annotation hierarchies) rather 
than having not been invoked at all, which in turn sounds to me more like an 
existing bug or incompleteness. It answers my question whether to remove it or 
not so let's not change it for now.




----------------------------------------------------------------
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


Reply via email to