Skip to content
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

MockReset should be honored without @Mockito[Spy]Bean fields #33829

Closed
sbrannen opened this issue Oct 31, 2024 · 0 comments
Closed

MockReset should be honored without @Mockito[Spy]Bean fields #33829

sbrannen opened this issue Oct 31, 2024 · 0 comments
Assignees
Labels
in: test Issues in the test module theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Milestone

Comments

@sbrannen
Copy link
Member

As can be seen in the tests introduced in commit 4a0edc5, the static factory methods in MockReset (such as MockReset.before() and MockReset.after()) can currently only be applied to beans within the ApplicationContext if the test class declares at least one field annotated with either @MockitoBean or @MockitoSpyBean.

However, as stated in the Javadoc, it should be possible to apply MockReset:

directly to any mock in the ApplicationContext using the static methods in this class.

We therefore need to rework the "enabled" logic in MockitoResetTestExecutionListener to support that documented use case.

@sbrannen sbrannen added in: test Issues in the test module type: bug A general bug labels Oct 31, 2024
@sbrannen sbrannen added this to the 6.2.0 milestone Oct 31, 2024
@sbrannen sbrannen self-assigned this Oct 31, 2024
@sbrannen sbrannen added the theme: aot An issue related to Ahead-of-time processing label Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test Issues in the test module theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant