Failing unit tests with mockito
I posted a question here
Mockito will report an exception in calling class and fail the test -but it would not print the trace. Check out for two stuff:
- toString -can it result in NPTR? Do not print the field values blindly, have a NULLability check there.
equals -While mocking, we pay not initialize the ID, for example if ID is a DB generated, then it’s NOT
part of constructor and one can easily forget to assign it..
- Check for exception which can occur in calling module -may be the problem is as simple as trace not being printed!