Mockito-Collections RC-01

The first release of Mockito-Collections is now available. To use Mockito-Collections in Maven, add the following dependency to your POM.

<dependency>
	<groupId>uk.co.webamoeba.mockito.collections</groupId>
	<artifactId>mockito-collections-core</artifactId>
	<version>1.0.0-RC-01</version>
	<scope>test</scope>
</dependency>

Documentation is available on the GitHub page: mockito-collections. To help get started, there are some samples available on GitHub: mockito-collections-1.0.0-RC-01/mockito-collections-samples.

Name Injection
Description Replaces the reptitive action of instantiating a collection adding the mocks to the collection and then setting it to the object being tested, with MockitoCollections#initialise(Object).
Before HandlerManagerTest.java
After HandlerManagerAlterantiveTest.java
Name Collective Verification
Description Replaces declaration of multiple mocks with one collection containing all of the mocks using the @CollectionOfMocks annotation. And replaces verification of interactions with each individual mock with MockitoCollections#collectiveVerify(Class, Collection).
Before ListenerManagerTest.java
After ListenerManagerAlternativeTest.java

 

 

 

Tweet about this on TwitterShare on FacebookShare on LinkedInShare on Google+Share on RedditEmail this to someone
Posted in Mockito-Collections