*/
@Test
public void testExecuteException()
{
/** Used for mocking objects. */
JUnit4Mockery mockContext = new JUnit4Mockery()
{
{
setImposteriser(ClassImposteriser.INSTANCE);
}
};
final DomainMapper followerMapper = mockContext.mock(DomainMapper.class, "followerMapper");
final DomainMapper followedMapper = mockContext.mock(DomainMapper.class, "followedMapper");
sut = new AddCachedGroupFollower(followedMapper, followerMapper);
mockContext.checking(new Expectations()
{
{
allowing(followerMapper).execute(TEST_GROUP_ID_1);
will(throwException(new PersistenceException()));
allowing(followedMapper).execute(TEST_GROUP_ID_1);
will(throwException(new PersistenceException()));
}
});
assertFalse(sut.execute(TEST_PERSON_ID_1, TEST_GROUP_ID_1));
mockContext.assertIsSatisfied();
}