-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Use single mock when backing bean is the same instance #15427
Conversation
|
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.
Looks good. But beware that there might be use cases where a shared mock does not help. For example, if both I2
and I3
extend some InterfaceX
and a user would attempt to mock InterfaceX#foo()
for each of the @InjectMock
(it's a corner case but still ;-).
...mockito/src/main/java/io/quarkus/test/junit/mockito/internal/CreateMockitoMocksCallback.java
Outdated
Show resolved
Hide resolved
integration-tests/injectmock/src/test/java/io/quarkus/it/mockbean/SameBeanInstanceTest.java
Outdated
Show resolved
Hide resolved
7f5f38e
to
4df5102
Compare
Yeah true. But at least this PR is better (or what both OP and @famod expected) than what we currently have :) |
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 was only able to review this briefly but LGTM!
Won't backport to 1.11 for now, we need some community baking for the PR. |
Fixes: #15411