Skip to content

Instantly share code, notes, and snippets.

@Qkyrie
Created December 5, 2013 09:27
Show Gist options
  • Save Qkyrie/7802516 to your computer and use it in GitHub Desktop.
Save Qkyrie/7802516 to your computer and use it in GitHub Desktop.
AbstractMockedTest. A Basic class where we init the mocks
public class AbstractMockedTest {
@Before
public void initMockitoAnnotations() {
MockitoAnnotations.initMocks(this);
}
protected void assertEmpty(Collection collection) {
Assert.assertTrue("Collection was expected to be empty", collection.isEmpty());
}
protected void assertEmptyString(String string) {
Assert.assertEquals("String was supposed to be empty", "", string);
}
protected void assertNotEmpty(Collection collection) {
Assert.assertFalse("Collection was not expected to be empty", collection.isEmpty());
}
protected void assertSize(int expectedSize, Collection collection) {
Assert.assertEquals(expectedSize, collection.size());
}
protected void assertSize(Collection collection1, Collection collection2) {
Assert.assertEquals(collection1.size(), collection2.size());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment