June 2018
Beginner
722 pages
18h 47m
English
One of the problems a unit test often faces is the need to test a method that uses a third-party library, a data source, or a method of another class. While testing, you want to control all the inputs so that you can predict the expected results of the tested code exactly. That is where the technique of simulating or mocking the behavior of the objects the tested code interacts with comes in handy.
The open source framework Mockito (root package name org.mockito) allows you to accomplish exactly that – the creation of mock objects. It is quite easy and straightforward to use. Here is one simple case:
Read now
Unlock full access