I have a Spring boot project that I'm migrating to Spring boot 2. Some of my tests that where working with the previous version are failing with the new version.
The issue is easy to reproduce.
I create 2 Controller. In the first, I inject a Service. In the second, I inject a JpaRepository.
Now I create UnitTests for both this Controller. For the second Controller, I mock the Repository. Everything works fine. For the first Controller, I mock the Service. The test fail. It seems to search to inject the Repository whereas it is not used in this Controller.
I create a very simple project to reproduce this behavior : https://github.com/YLombardi/mockito-spring-jpa-issue
Is it my test that is wrong or a bug ?