-
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
Mockito extension not working with @QuarkusTest
#24911
Comments
/cc @geoand |
There is a special I don't think |
This is an inherent limitation of how we handle tests - we essentially need to create a proxy of the test class. FWIW, you can use |
Would Also this means any Mockito extension functionality, as |
It only works for beans |
There are various limitations, yes. I never said it was a good approach, it was however the only one that allowed us to support the feature set we need. If JUnit supports loading test classes from a custon ClassLoader in the future (there is an open issue), we could ditch this approach. |
Describe the bug
Having a test with:
will not correctly utilize the
MockitoExtension
and Mockito annotated fields will not be initialized.Expected behavior
org.mockito
annotations are correctly initializedActual behavior
Seems that Mockito extension is initalizing the fields in the different test instance. Simple debugging I did showed that mockito correctly initialized fields in my test instance
{GrpcClientsTest@10823}
, while the actual instance being used in the test is{GrpcClientsTest@10895}
.How to Reproduce?
No response
Output of
uname -a
orver
Linux ise-Precision-5550 5.13.0-39-generic #44~20.04.1-Ubuntu SMP Thu Mar 24 16:43:35 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.8.0.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)pache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537) Maven home: /home/ise/.m2/wrapper/dists/apache-maven-3.8.4-bin/52ccbt68d252mdldqsfsn03jlf/apache-maven-3.8.4 Java version: 17.0.2, vendor: Private Build, runtime: /usr/lib/jvm/java-17-openjdk-amd64 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "5.13.0-39-generic", arch: "amd64", family: "unix"
Additional information
No response
The text was updated successfully, but these errors were encountered: