-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for @WeldSetup annotated fields in test superclasses #32
Comments
Hello, yea, you are right about this bug. Thanks for the effort with debugging/nailing it down. |
Note that |
The documentation doesn't indicate this:
|
The extension was designed to be able to access even non-public fields. I would prefer to retain this ability but the requirement to grab this field from superclass should definitely be supported. Maybe we should inspect the hierarchy but still allow non-public fields? The current class' field would be prioritized, but if there is none, we could inspect the hierarchy and search for any fitting field. Does that sound sane? |
+1 @qmunke something like this should work:
|
@rakcheru Yes, we're going to release 1.2.2 later today or tomorrow morning (CET). |
Currently if a test class inherits from a parent containing a field annotated with
@WeldSetup
, theWeldJUnit5Extension
doesn't pick it up and creates a default instance - due to the call toClass#getDeclaredFields
as opposed toClass#getFields
. This leads to confusing errors depending on how you're trying to inject into the test (either getting "Container not started" if you reference the super'sWeldInitiator
from the subclass, or exceptions about unsatisfied dependencies if you try and@Inject
a class that isn't picked up by the default instance)See https://github.com/qmunke/weld-junit/commit/b77d16f10b4d75bd96a686a5c144fc0999c5e684 for a potential fix.
The text was updated successfully, but these errors were encountered: