### Question:
AccountServiceImpl implements AccountService { @Override public void deleteAccount(final String username) { try { accountRepository.deleteById(username); } catch (final Exception ex) { final String errorMessage = String.format("An error occured while deleting account %s: %s", username, ex.getMessage()); log.error(errorMessage, ex); throw new AccountPersistenceException(errorMessage, ex); } }  @Override Optional<AccountDto> getAccount(final String username); @Override Optional<AccountDto> getAccount(final String username, final String password); @Override AccountDto createAccount(final AccountDto accountDto); @Override AccountDto updateAccount(final AccountDto accountDto); @Override void deleteAccount(final String username);  }### Answer:
@Test public void test_deleteAccount_successfulDelete() { accountService.deleteAccount(TEST_USERNAME); verify(accountRepository).deleteById(TEST_USERNAME); }
@Test(expected = AccountPersistenceException.class) public void test_deleteAccount_runtimeException() { doThrow(new RuntimeException()).when(accountRepository).deleteById(TEST_USERNAME); accountService.deleteAccount(TEST_USERNAME); }