Hello, i want to test my api-controller using unit tests in junit but i cant seem to understand which is the correct way.
Different approaches:
-
Mock the behaviour of the controller and call the controller-method directly. Asserting using assertequals().
-
Call the endpoint using mockMvc? Asserting using andexpect().
I was thinking that maybe nr2 approach can be covered using api-tests in postman? Can anyone point me in the right direction? 🙂
Thanks in advance!