JdbcAccountRepository implements AccountRepository { @Override public int deleteAccount(Long id) { String sqlTxt = "delete from account where id=?"; return template.update(sqlTxt, id); } @Autowired  JdbcAccountRepository(DataSource dataSource); @Override List<Account> getAccounts(); @Override Account getAccount(Long id); @Override int getNumberOfAccounts(); @Override Long createAccount(BigDecimal initialBalance); @Override void updateAccount(Account account); @Override int deleteAccount(Long id);  }
@Test public void testDeleteAccount() throws Exception { for (Account account : repository.getAccounts()) { repository.deleteAccount(account.getId()); } assertThat(repository.getNumberOfAccounts(), is(0)); }