@Test public void onAddTransaction_shouldCallListener() { HttpTransaction httpTransaction = getHttpTransactionWithIndex(1); simpleTransactionDataStore.addTransaction(httpTransaction); verify(dataChangeListener, only()).onDataChange(TransactionDataStore.Event.ADDED, httpTransaction); }
@Override public void addTransaction(HttpTransaction httpTransaction) { guardForZeroAndNegativeIndices(httpTransaction.getId()); addVerifiedTransaction(httpTransaction); sendDataChangeEvent(Event.ADDED, httpTransaction); }
SimpleTransactionDataStore implements TransactionDataStore { @Override public void addTransaction(HttpTransaction httpTransaction) { guardForZeroAndNegativeIndices(httpTransaction.getId()); addVerifiedTransaction(httpTransaction); sendDataChangeEvent(Event.ADDED, httpTransaction); } }
SimpleTransactionDataStore implements TransactionDataStore { @Override public void addTransaction(HttpTransaction httpTransaction) { guardForZeroAndNegativeIndices(httpTransaction.getId()); addVerifiedTransaction(httpTransaction); sendDataChangeEvent(Event.ADDED, httpTransaction); } SimpleTransactionDataStore(); }
SimpleTransactionDataStore implements TransactionDataStore { @Override public void addTransaction(HttpTransaction httpTransaction) { guardForZeroAndNegativeIndices(httpTransaction.getId()); addVerifiedTransaction(httpTransaction); sendDataChangeEvent(Event.ADDED, httpTransaction); } SimpleTransactionDataStore(); @Override void addTransaction(HttpTransaction httpTransaction); @Override boolean updateTransaction(HttpTransaction httpTransaction); @Override boolean removeTransactionWithIndex(long index); @Override int clearAllTransactions(); @Override List<HttpTransaction> getDataList(); @Override HttpTransaction getTransactionWithId(long id); @Override void addDataChangeListener(DataChangeListener dataChangeListener); @Override void removeDataChangeListener(DataChangeListener dataChangeListener); }
SimpleTransactionDataStore implements TransactionDataStore { @Override public void addTransaction(HttpTransaction httpTransaction) { guardForZeroAndNegativeIndices(httpTransaction.getId()); addVerifiedTransaction(httpTransaction); sendDataChangeEvent(Event.ADDED, httpTransaction); } SimpleTransactionDataStore(); @Override void addTransaction(HttpTransaction httpTransaction); @Override boolean updateTransaction(HttpTransaction httpTransaction); @Override boolean removeTransactionWithIndex(long index); @Override int clearAllTransactions(); @Override List<HttpTransaction> getDataList(); @Override HttpTransaction getTransactionWithId(long id); @Override void addDataChangeListener(DataChangeListener dataChangeListener); @Override void removeDataChangeListener(DataChangeListener dataChangeListener);  }