-
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 feedback #34926
Comments
/cc @geoand (testing) |
I'd say this is expected given that we skip lots of Quarkus bootstrapping. In fact, I'd expect more of these functionalities that are there for convinience won't work because they mainly reside in Quarkus integration code whereas here we try to boot very minimal CDI (Arc) and some MP config with that.
That does look like a bug, thanks for reporting it back. |
@manovotn even though |
The issue [1] Skipping Quarkus bootstrap would cause other issues, though. For example, I think static methods won't be intercepted in |
You're right, I meant to say we skip the bytecode transformation that full blown Quarkus normally does.
Yes, that's the other case I could think of. |
I briefly looked at ArC and this is what we use bytecode transformations for:
|
I figured out how to support bytecode transformations in |
We should be able to fix this thanks to @Ladicek's work. TBH I'm not very happy we'll introduce this kind of hack. But if it helps 🤷.
You should get a different error in the main branch, something like |
I also tried the new extension and it is sort of disappointing that quarkus does support beans without a no-args constructor but I understand that CDI specs require it, but it would be a better user experience if the Otherwise, it is an awesome extension :) |
I had a pull request that allowed this, see #35473. It requires a fairly ugly "classloader dance", so I ended up closing it -- but that doesn't mean we don't want to do this. It is very much supposed to work (at least from my perspective :-) ) @holly-cummins is pursuing a holistic cleanup of classloader manipulation in the testing extensions, which should make this much less invasive. It's a long run though. |
Thanks! Nice to know it was not forgotten or abandoned. Looking forward to the improvement! |
This issue duplicates #43339. |
Description
I started playing with the new
@QuarkusComponentTest
. At first glance I really do like it as it is really fast in comparison of QuarkusTest.While using I found 2 things that made it a bit tedious when I first tried it.
1- In quarkus the no args constructor are generated, but QuarkusComponentTest requires it when there is already a non no-arg constructor present. (i.e. single constructor without the Inject annotation)
I am not sure this is actually possible to fix, but it would be nice if I did not have to change my sources to use that test strategy. Meaning it would be nice if it could auto-magically create the no arg ctor as quarkus does when running the an app.
This is the error I get while running the test is the following
jakarta.enterprise.inject.spi.DeploymentException: Normal scoped beans must declare a non-private constructor with no parameters: CLASS bean [types=[org.acme.Foo, java.lang.Object], qualifiers=[@Default, @Any], target=org.acme.Foo]
code to reproduce is as follow; adding commented out ctor + the
@Inject
makes the test work, but the app works without it.2- When Using
@InjectMock
on a bean that is not needed for example changing the above Foo class like this;If my test class still has the
@InjectMock
of the Charlie bean, a NPE will follow like this one; which make troubleshooting quite hard as it does not tell what the issue is nor where it is.Implementation ideas
No response
The text was updated successfully, but these errors were encountered: