I updated my project with the latest revision of Spring (2.0.0.RELEASE) and while my tests worked in 2.0.0.RC1, now it doesn't work and it keeps giving me this error :
org.mockito.exceptions.base.MockitoException: Cannot instantiate @InjectMocks field named 'service'! Cause: the type 'PersonService' is an interface. You haven't provided the instance at field declaration so I tried to construct the instance. Examples of correct usage of @InjectMocks: @InjectMocks Service service = new Service(); @InjectMocks Service service; //and... don't forget about some @Mocks for injection :) Here I made a minimal project where you can change the version in the pom file to see it succeed on 2.0.0.RC1 and fail in 2.0.0.RELEASE.
For the a full minimal test - please turn to gituhub.
AutowiredandSpringBootTestannotations.