Unit Testing with Mocks: Creating Mocks & Verifying Behavior
Mocks built in Mockito do more than just simulate the behavior of complex objects that your object under test depends upon. Mockito makes it easy for you to verify specific aspects of how the object under test and the mock interact. In this course learn how to build mocks using annotations and use them to perform dependency injection into the object. Then learn how to work with constructor setter property and field injection. Moving along verify the behavior of the object under test and its interaction with the mock using Mockito constructs such as verify() verifyNoInteractions() and various argument matchers. When youre done youll be able to use annotations to construct mocks in a clean and simple manner and test very specific aspects of the interactions between the stubs in your mocks and the object under test.