Closed prajaktaNextdoor closed 2 years ago
I've edited your comment to improve the formatting. You might want to check out this Mastering Markdown guide for future reference.
Thanks for getting in touch, but it feels like this is a question that would be better suited to Stack Overflow. We prefer to use the issue tracker only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug.
Aside from the fact that the code you supplied does not compile, the issue you are describing sounds like it is related to Spring Boot instead of JUnit.
The code was just a pseudo code to give an overview of the scenario I am testing. It was not meant to be a production ready code. Thanks.
I have a class that I want to test using
@SpringBootTest
annotation. I have autowired the class under test in the test class. The class under test calls afactory.getInstance
method which returns a real bean of required type. This bean has a dependency autowired. When I run my test using circleci, I do see this autowired dependency injected as a mock instance. This is weird as my test class is not mocking any beans.When I run the test on my local, I do not see the dependency as mocked. It is a real instance as expected. Could you please guide me in why this dependency may be getting mocked in circleci run?
Thanks,
Praj