@Test(expected = UserAlreadyRegisteredException.class)
public void shouldThrowExceptionAddingDuplicateEmail() throws UserAlreadyRegisteredException, EmailFailedException {

    Database mockDatabase = Mockito.mock(Database.class);
    EmailSender mockEmailSender = Mockito.mock(EmailSender.class);
    UserRegistration testee = new UserRegistration(mockDatabase, mockEmailSender);
    Mockito.when(mockDatabase.hasUser("foo@example.com")).thenReturn(true);
    testee.registerNewUser("foo@example.com");
}