Your test is wonderful. It should not even have the @ContextConfiguration annotation.
An entire dependency injection infrastructure, such as Spring, should be able to provide unit tests with services by simply instantiating them, installing mock dependencies, and then calling their methods.
You are doing it right. For such unit tests, you do not need to have a Spring context. That's why they are called unit tests: they test it against all of their actual dependencies, including Spring.
Side note: if you are using JUnit, the arguments to the assertXxx method must be replaced. The expected value comes before the actual value. This becomes important when the statement fails, and you have a message like "expecting 6, but it was 3", and not "expecting 3, but it was 6".
source share