I am trying to write junit test cases for my Spring boot application written in 1.2.5.RELEASE version
I have read the spring boot documentation https://docs.spring.io/spring-boot/docs/1.2.5.RELEASE/reference/htmlsingle/ and trying to write the test case.
Now I want to mock a class which is already a @Primary class in original application.
see the issue here - How to mock a class that been annotated with Primary
On further read I understand that I need to use @MockBean to mock a class which is already a primary in application. But the problem is the spring boot version which I use does not support @MockBean.
I have tried overriding spring-boot-starter-test version alone with 2.1.7.RELEASE(without changing the spring boot parent version as I am not supposed to change the application spring boot version which has many impacts). Now I am able to use @MockBean, but on running the test case, it ends in exception.
java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotationUtils.getRepeatableAnnotations
How can I use @MockBean in spring boot 1.2.5.RELEASE?
Is there any workaround without using @MockBean?