When testing an API (with, for example, Java), what parts should I actually be testing when calling methods of my Controller class (e.g. a Spring
For example, lets say I've got a
logIn method in my controller.
Said method calls some methods of another class (i.e. my Service class), ultimately returning a login token/session/...
Should I now only be testing whether the Response I send to clients is valid, i.e. contains correct headers, cookies, and so on - or, should I be testing whether or not the login token/session/other-thing-that's-made-by-the-service-class is valid as well?
(I'd imagine these tests would go in a separate class that specifically test my Service Class and it's methods (which generate my login token/session/...) - but even then, how would I go about mocking the user data that's needed to create my login token/session objects?)