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



##########
File path: 
webbeans-junit5/src/main/java/org/apache/openwebbeans/junit5/internal/CdiExtension.java
##########
@@ -172,4 +182,76 @@ private void doClose(final SeContainer container)
             }
         });
     }
+
+    private Cdi getCdiConfig(ExtensionContext extensionContext)
+    {
+        return AnnotationUtils.findAnnotation(extensionContext.getElement(), 
Cdi.class).orElse(null);
+    }
+
+    private SeContainer getContainer()
+    {
+        if (testInstanceContainer != null)
+        {
+            return testInstanceContainer;
+        }
+        else
+        {
+            return reusableContainer;
+        }
+    }
+
+    @Override
+    public boolean supportsParameter(ParameterContext parameterContext, 
ExtensionContext extensionContext)
+            throws ParameterResolutionException
+    {
+        final Cdi config = 
extensionContext.getParent().map(this::getCdiConfig).orElse(null);

Review comment:
       `extensionContext` here is a MethodExtensionContext while 
`extensionContext` in beforeAll is a ClassExtensionContext which is the parent. 
Methods always have classes as parents and there also will always be a parent 
class for a method.
   However, I'm not fully satisfied that this will work with all situations 
such as dynamic tests, nested test classes, or whatever else. For a beginning I 
tend to opt that this is no worse than before but it can be further elaborated 
as desired.




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