@Test public void testAddAccount() throws Exception { accountDao.addAccount(testAccount); verify(mockConnection).prepareStatement(anyString()); accountDao.addAccount(testAccount); verify(mockConnection).prepareStatement(anyString()); }
public void addAccount(Account account) throws SQLException { try { PreparedStatement insertStatement = dataAccessor.getPreparedStatement(insertSql); insertStatement.setString(1, AccountCollectionSerde.accountToJsonNoContainers(account).toString()); insertStatement.setInt(2, account.getSnapshotVersion()); insertStatement.executeUpdate(); } catch (SQLException e) { dataAccessor.reset(); throw e; } }
AccountDao { public void addAccount(Account account) throws SQLException { try { PreparedStatement insertStatement = dataAccessor.getPreparedStatement(insertSql); insertStatement.setString(1, AccountCollectionSerde.accountToJsonNoContainers(account).toString()); insertStatement.setInt(2, account.getSnapshotVersion()); insertStatement.executeUpdate(); } catch (SQLException e) { dataAccessor.reset(); throw e; } } }
AccountDao { public void addAccount(Account account) throws SQLException { try { PreparedStatement insertStatement = dataAccessor.getPreparedStatement(insertSql); insertStatement.setString(1, AccountCollectionSerde.accountToJsonNoContainers(account).toString()); insertStatement.setInt(2, account.getSnapshotVersion()); insertStatement.executeUpdate(); } catch (SQLException e) { dataAccessor.reset(); throw e; } } AccountDao(MySqlDataAccessor dataAccessor); }
AccountDao { public void addAccount(Account account) throws SQLException { try { PreparedStatement insertStatement = dataAccessor.getPreparedStatement(insertSql); insertStatement.setString(1, AccountCollectionSerde.accountToJsonNoContainers(account).toString()); insertStatement.setInt(2, account.getSnapshotVersion()); insertStatement.executeUpdate(); } catch (SQLException e) { dataAccessor.reset(); throw e; } } AccountDao(MySqlDataAccessor dataAccessor); void addAccount(Account account); List<Account> getNewAccounts(long updatedSince); void updateAccount(Account account); }
AccountDao { public void addAccount(Account account) throws SQLException { try { PreparedStatement insertStatement = dataAccessor.getPreparedStatement(insertSql); insertStatement.setString(1, AccountCollectionSerde.accountToJsonNoContainers(account).toString()); insertStatement.setInt(2, account.getSnapshotVersion()); insertStatement.executeUpdate(); } catch (SQLException e) { dataAccessor.reset(); throw e; } } AccountDao(MySqlDataAccessor dataAccessor); void addAccount(Account account); List<Account> getNewAccounts(long updatedSince); void updateAccount(Account account); static final String ACCOUNT_TABLE; static final String ACCOUNT_INFO; static final String VERSION; static final String CREATION_TIME; static final String LAST_MODIFIED_TIME; static final String ACCOUNT_ID; }