Open utterances-bot opened 2 years ago
I am having this issue with use of SpringBeans with mocking and stubbing:
https://github.com/spockframework/spock/issues/1084
I am still struggling with how to inject the stub or mock impl for a spring Bean within the spring ApplicationContext which is created before the stub/mock are created.
Hey @farrukhnajmi. I'm not sure if I understand your issue correctly.
Are you stubing outside of test specification file? Maybe stubing inside spec file could resolve your issue? Or you can try to use old way of using spring contex config explicitly https://www.dovydasvenckus.dev/java/2019/05/05/mocking-spring-beans-with-spock/#old-way?
I'm not really familiar with inner workings of spock framework. So I'm not sure if my tips will help you :)
Thanks you for this example. It was very helpful.
Mocking Spring beans with Spock
Mocking Spring beans with Spock.
https://www.dovydasvenckus.dev/java/2019/05/05/mocking-spring-beans-with-spock/