Hacker News new | ask | show | jobs
by scubaguy 4481 days ago
This is not a good example, because in this example, Mockito is used to mock a very simple class (DateTime), which should not be mocked at all. It is also used to verify that the dependent object is called exactly twice, which may be unnecessary.

This is more of a problem where a library is not used well. Mockito is a very good library, this example really does it disservice.

1 comments

Mockito easily leads to a false belief that code is tested. Mocking dependencies and simply asserting those mocks is useless yet I see that all the time.