You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I am creating some beans programmatically via BeanDefinitionRegistryPostProcessor and postProcessBeanDefinitionRegistry.
The problem I am facing is that for some tests I need to mock one of the beans created programmatically
When using @MockkBean annotation sometimes the mocked bean does replace the original bean while sometimes it does not.
I suspect that the issue is the bean creation via code is too slow and the replacement of the mocked bean happens before the initialization is complete.
Is there any workaround for this?
The text was updated successfully, but these errors were encountered:
There is no way I can answer this question without a complete minimal reproduction. But even then, given that SpringMockk is just a clone of the official Spring Boot Mockito testing support, start by reproducing the issue with Mockito. And if you reproduce it, then ask in Spring Boot channels for help, because it won't be specific to SpringMockK.
If on the other hand you can't reproduce the issue with Spring Boot's native Mockito support, but can reproduce it with SpringMockK, then provide the two reproductions and I'll try to have a look at what's different between SpringMockK and Spring Boot.
Hi,
I am creating some beans programmatically via BeanDefinitionRegistryPostProcessor and postProcessBeanDefinitionRegistry.
The problem I am facing is that for some tests I need to mock one of the beans created programmatically
When using @MockkBean annotation sometimes the mocked bean does replace the original bean while sometimes it does not.
I suspect that the issue is the bean creation via code is too slow and the replacement of the mocked bean happens before the initialization is complete.
Is there any workaround for this?
The text was updated successfully, but these errors were encountered: