-
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
ExceptionInInitializerError inside a JUnit5 unit test (not a @QuarkusTest) since 1.1.0.CR1 #6131
Comments
I'm a bit confused. How do you run the test if not using |
Raw JUnit5 test, I mock all dependencies (for a service: all repositories, for a rest endpoint, all services, ...). According to me, using |
@loicmathieu who starts / calls RESTEasy in your test? Do you start Quarkus yourself somehow? |
Not starting resteasy nor Quarkus, just plain Java! As I said, it's a unit test, not an integration test, so I did't bootstrap Quarkus and I mock all dependencies of my service. |
I think a small reproducer would be welcome. It doesn't have to have a lot of dependencies or whatever, just the gist of it. |
Looks like something that did not need mocking, now does. Or at elast your mocking does go as far as |
Hm, the |
@mkouba I think your analysis of the issue is correct :) |
The issue itself can be fixed by installing a config into |
Sorry, I never followed up. Here's an example: |
@dmlloyd the issue is fixed by this piece of code
However I will qualify it of a workaround not a fix. And it works without it in 1.0.1.Final. |
Yes, for now at least. The problem is that the tests assume there is some configuration. But what configuration would it be? Not build time, nor run time, because the test is not running under the purview of Quarkus. Therefore the user must take care to manually set up a configuration; letting the config auto-create encourages leakage (I fixed up a number of these already, which is what led me to the more strict behavior). Leakage impacts testing because the changing the order of test execution can result in different test results if there is more than one configuration in play. So, manually it can be done via |
What I would love to see in order to close this issue is the following:
Maybe, as the issue seems to be around http related stuff, we need to provides some http test support to be able to easily mock an HttpRequest, an HttpResponse, HttpHeaders, ... |
Hi @loicmathieu @gsmet @dmlloyd we have #5700 which when when fixed will address this point. It will come with documentation as a bonus. I self assigned the issue but as I am on PTO, I have not had the time to look at it implementing it. @loicmathieu or anyone can feel free to give it a go based on the code snippet @dmlloyd shared. Thanks |
I'm having the same issue and thus not updating to Maybe some tests on running components such as the JAX-RS client ( Are there any updates on this? Happy to help in any way, btw. |
@machi1990 Thanks, using |
This fixes also the issue for me, closing it. |
Describe the bug
After migrating to 1.1.0.CR1 from an application running on 1.0.1.Final I have the following error when launching a JUnit5 raw test (a test without using Quakus support via
@QuarkusTest
).Expected behavior
No exception thrown
To Reproduce
I still don't know exactly what happend so it's hard to give a reproducer.
Environment (please complete the following information):
uname -a
orver
: Linux 5.3.0-24-generic Modify BeanArchiveProcessor so that implicit bean archives are added to the index #26-Ubuntu SMP Thu Nov 14 01:33:18 UTC 2019 x86_64 x86_64 x86_64 GNU/Linuxjava -version
: openjdk version "11.0.5" 2019-10-15The text was updated successfully, but these errors were encountered: