-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
@QuarkusComponentTest doesn't initialize injected beans #42643
Comments
cc @mkouba |
Yes, it seems that we incorrectly detect the component classes for |
@mkouba Thank you for your reply! |
You should only add implementations, i.e. something like Unfortunately, the only workaround I can see is to annotate those beans with
I agree that it's not very convenient (although mentioned in the javadoc of |
@dasha-klim Hm, I've just realized that even if we treat |
- handle programmatic lookup injection points specifically: register type arguments as tested components and consider these types in the unused beans removal exclusion - support programmatic lookup in test method params (`Instance<>`, `@All List<>`) - add "Tested components" section in the docs - related to quarkusio#42643
@mkouba , thank you for looking into the issue! |
@mkouba |
Not really. Unfortunately, you can't use |
I assume you're trying to inject |
- handle programmatic lookup injection points specifically: register type arguments as tested components and consider these types in the unused beans removal exclusion - support programmatic lookup in test method params (`Instance<>`, `@All List<>`) - add "Tested components" section in the docs - related to quarkusio#42643
- handle programmatic lookup injection points specifically: register type arguments as tested components and consider these types in the unused beans removal exclusion - support programmatic lookup in test method params (`Instance<>`, `@All List<>`) - add "Tested components" section in the docs - related to quarkusio#42643 (cherry picked from commit 04a0211)
As explained in #42643 (comment) we can't fix this issue completely. The fix in #42779 is IMO the best thing we can do. Feel free to reopen this issue or open a new discussion. |
- handle programmatic lookup injection points specifically: register type arguments as tested components and consider these types in the unused beans removal exclusion - support programmatic lookup in test method params (`Instance<>`, `@All List<>`) - add "Tested components" section in the docs - related to quarkusio#42643
- handle programmatic lookup injection points specifically: register type arguments as tested components and consider these types in the unused beans removal exclusion - support programmatic lookup in test method params (`Instance<>`, `@All List<>`) - add "Tested components" section in the docs - related to quarkusio#42643
Describe the bug
@QuarkusComponentTest
doesn't allow to inject a list of classes that implement a specific interface using@Inject
@All annotations
Like:
Each class that implements the interface is annotated with
@ApplicationScoped
@Startup
and has a@Postconstruct
method which doesn't get called at all when running a test.Expected behavior
Classes are injected
Actual behavior
List of classes remains empty.
How to Reproduce?
Reproducer: https://github.com/dasha-klim/quarkus_test.git
Output of
uname -a
orver
No response
Output of
java -version
17.0.11
Quarkus version or git rev
No response
Build tool (ie. output of
mvnw --version
orgradlew --version
)gradle
Additional information
If it is expected behaviour and the @QuarkusComponentTest shouldn't allow this to be done, how it should be done without using @QuarkusTest annotation and starting the whole quarkus application as we have a lot of other verticles and services that we don't need for testing.
The text was updated successfully, but these errors were encountered: