UserRegistration { public void deleteUser(String emailAddress) throws UserNotFoundException { database.deleteUser(emailAddress); } UserRegistration(Database database, EmailSender emailSender); void registerNewUser(String emailAddress); void deleteUser(String emailAddress);  }
@Test(expected = UserNotFoundException.class) public void shouldThrowExceptionDeletingUserNotInDatabase() throws UserNotFoundException { String email = "foo@example.com"; Mockito.doThrow(UserNotFoundException.class).when(mockDatabase).deleteUser(email); testee.deleteUser(email); }