-
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 testing - manually activate req. context when creating Mockito spies #35606
Conversation
This comment has been minimized.
This comment has been minimized.
integration-tests/injectmock/src/test/java/io/quarkus/it/mockbean/RequestScopedSpyTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I confess I didn't look elsewhere to see what we do with the request context. (Is it properly destroyed somewhere?)
This comment has been minimized.
This comment has been minimized.
Good point @Ladicek; I have now made use of |
This comment has been minimized.
This comment has been minimized.
...mockito/src/main/java/io/quarkus/test/junit/mockito/internal/CreateMockitoSpiesCallback.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment that should be very easy to address
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌🏼
✔️ The latest workflow run for the pull request has completed successfully. It should be safe to merge provided you have a look at the other checks in the summary. |
Hm, this might not have been right - I am just discussing it with Martin. |
👌🏼 |
Fixes #35581
Allows to use req. scoped Mockito spies.
ATM we initialize all spies right after creation of test instance - this is fine except there is no req. scope active because we active that for each test method. This fix activates/deactivates req. context when creating spies.