Skip to content

@MockitoBean behavior is not consistent with @MockBean when using @PostConstruct #34120

Closed as not planned
@MateuszWicherski

Description

@MateuszWicherski

When switching from using @MockBean annotation to @MockitoBean in one of our projects, I have found some inconsistency between the two, if @PostConstruct annotation is being used along with MockReset.NONE. Here is the minimal reproductive example.

I suspect, that there was some change in the time when resetting the mocks happen - for some reason @MockitoBean is being reset after @PostConstruct is resolved, even though the MockReset.NONE is being used for its configuration - this is not a case for @MockBean.

Metadata

Metadata

Assignees

Labels

in: testIssues in the test modulestatus: duplicateA duplicate of another issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions