Closed paramadeep closed 1 month ago
we could add a check to see if all the mock functions are asserted for all the call it received with expected parameters.
I couldn't grasp the concept from the description. Can you provide sample code where you want to make it error/warn? Links to how other frameworks do this would also help.
Since this issue hasn't been discussed for half a year, I believe it's safe to close it.
Clear and concise description of the problem
This is a practice I want to enforce on my team. There is no automated way to ensure the mocks are done properly. I can give an instance for this. It is a test for controller method. My team didn't even added a request body to the test. Since we are not asserting params passed to the downstream mocked service, they have just returned the expected response.
Suggested solution
we could add a check to see if all the mock functions are asserted for all the call it received with expected parameters. This check can be set as off, warn and error mode through config. MockIt to have similar feature. It will fail the test, if any of the mock is not used in the test. Though it doesn't check if all mocks function params are asserted, java enforce using params while setting mocks.
Alternative
No response
Additional context
No response
Validations