@Test public void onUpdateTransactionWithZeroTransactionId_shouldThrowZeroIndexException() { assertThatExceptionOfType(TransactionDataStore.ZeroIndexException.class) .isThrownBy(new ThrowableAssert.ThrowingCallable() { @Override public void call() { simpleTransactionDataStore.updateTransaction(getHttpTransactionWithZeroIndex()); } }) .withNoCause(); }
@Override public boolean updateTransaction(HttpTransaction httpTransaction) { guardForZeroAndNegativeIndices(httpTransaction.getId()); if (contains(httpTransaction)) { addVerifiedTransaction(httpTransaction); sendDataChangeEvent(Event.UPDATED, httpTransaction); return true; } return false; }
SimpleTransactionDataStore implements TransactionDataStore { @Override public boolean updateTransaction(HttpTransaction httpTransaction) { guardForZeroAndNegativeIndices(httpTransaction.getId()); if (contains(httpTransaction)) { addVerifiedTransaction(httpTransaction); sendDataChangeEvent(Event.UPDATED, httpTransaction); return true; } return false; } }
SimpleTransactionDataStore implements TransactionDataStore { @Override public boolean updateTransaction(HttpTransaction httpTransaction) { guardForZeroAndNegativeIndices(httpTransaction.getId()); if (contains(httpTransaction)) { addVerifiedTransaction(httpTransaction); sendDataChangeEvent(Event.UPDATED, httpTransaction); return true; } return false; } SimpleTransactionDataStore(); }
SimpleTransactionDataStore implements TransactionDataStore { @Override public boolean updateTransaction(HttpTransaction httpTransaction) { guardForZeroAndNegativeIndices(httpTransaction.getId()); if (contains(httpTransaction)) { addVerifiedTransaction(httpTransaction); sendDataChangeEvent(Event.UPDATED, httpTransaction); return true; } return false; } 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 boolean updateTransaction(HttpTransaction httpTransaction) { guardForZeroAndNegativeIndices(httpTransaction.getId()); if (contains(httpTransaction)) { addVerifiedTransaction(httpTransaction); sendDataChangeEvent(Event.UPDATED, httpTransaction); return true; } return false; } 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);  }