JdbcAccountRepository implements AccountRepository { @Override public Long createAccount(BigDecimal initialBalance) { String sqlTxt = "insert into account(id,balance) values(?,?)"; long id = nextId++; int uc = template.update(sqlTxt, id, initialBalance); return 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 testCreateAccount() throws Exception { Long id = repository.createAccount(new BigDecimal("250.00")); assertThat(id, is(notNullValue())); Account account = repository.getAccount(id); assertThat(account.getId(), is(id)); assertThat(account.getBalance(), is(closeTo(new BigDecimal("250.0"), new BigDecimal("0.01")))); }