10000 The MockitoBean annotation is not processed when using a TestConfiguration annotated class · Issue #44496 · spring-projects/spring-boot · GitHub
[go: up one dir, main page]

Skip to content
The MockitoBean annotation is not processed when using a TestConfiguration annotated class #44496
72AC @umekong

Description

@umekong

This issue is currently being observed in version 3.4.3.
Here is quick bit of code to highlight issue

@SpringBootTest
class MockObjectTest {
    @Test
    void doNothing() {
        // test started up fine
    }

    @TestConfiguration
    static class InitMocks {
        @MockBean // deprecated and set for removal in 3.6.0
        private SomeObject mockBean;

        @MockitoBean
        private SomeObject mockitoBean;

        @PostConstruct
        public void init() {
            assertNotNull(mockBean); // successful
            assertNotNull(mockitoBean); // fails
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0