Blog Archives

Unit Testing

Mockito is a mocking Framework <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-all</artifactId> <version>${mockito.version}</version> <scope>test</scope> </dependency> It allows us to easily mock objects: mock(MyService.class) //using mock static method or @Mock +  MockitoAnnotations.initMocks(this); We can specify the desired behavior of the mocks using Mockito’s fluent APIs:

Tagged with: , ,
Posted in JUnit, Mockito, Testing