I am trying to see how test cases can drive interface design.
Now, if I have an interface with a method:
public interface UserService { User getNextUser(); }
and if UserServiceImpl is an implementation of UserService, then as per my understanding of mock objects, I should only mock the dependencies of the UserServiceImpl, like a UserRepository, because only then am I actually testing behaviour, i.e. does UserServiceImpl call UserRepository or not.
But then, if I must write a UserServiceTest, without creating a UserServiceImpl, then the only way I see is to create a mock of UserService, which doesn't seem quite right.
Where am I going wrong with this?