JdbcAccountRepository implements AccountRepository { @Override public void updateAccount(Account account) { String sqlTxt = "update account set balance = ? where id = ?"; template.update(sqlTxt, account.getBalance(), account.getId()); } @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 testUpdateAccount() throws Exception { Account account = repository.getAccount(1L); BigDecimal current = account.getBalance(); BigDecimal amount = new BigDecimal("50.0"); account.setBalance(current.add(amount)); repository.updateAccount(account); Account again = repository.getAccount(1L); assertThat(again.getBalance(), is(closeTo(current.add(amount), new BigDecimal("0.01")))); }