- 
                Notifications
    You must be signed in to change notification settings 
- Fork 41.6k
Closed as not planned
Labels
for: external-projectFor an external project and not something we can fixFor an external project and not something we can fixstatus: supersededAn issue that has been superseded by anotherAn issue that has been superseded by anothertype: enhancementA general enhancementA general enhancement
Description
Using @MockBean on test fields is a very succinct way to mock components.
At the moment, it only works with JUnit tests via SpringRunner.
It would be great if it also worked with TestNG via AbstractTestNGSpringContextTests.
Example
@SpringBootTest
public class TestNGMockBeanTest extends AbstractTestNGSpringContextTests {
    @MockBean
    DemoComponent demoComponent;
    @Test
    public void mockBeanShouldWork() {
        assertTrue(demoComponent != null, "demoComponent is null");
        assertTrue(new MockUtil().isMock(demoComponent), "demoComponent is not a mock");
    }
}Desired behaviour: Test passes.
Current behaviour: "demoComponent is null" assertion triggers.
Krasnyanskiy, richardfrosztega, juherr, dvdrhr, akuhtz and 6 more
Metadata
Metadata
Assignees
Labels
for: external-projectFor an external project and not something we can fixFor an external project and not something we can fixstatus: supersededAn issue that has been superseded by anotherAn issue that has been superseded by anothertype: enhancementA general enhancementA general enhancement