### Question:
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);  }### Answer:
@Test public void onUpdateTransactionWithZeroTransactionId_shouldThrowZeroIndexException() { assertThatExceptionOfType(TransactionDataStore.ZeroIndexException.class) .isThrownBy(new ThrowableAssert.ThrowingCallable() { @Override public void call() { simpleTransactionDataStore.updateTransaction(getHttpTransactionWithZeroIndex()); } }) .withNoCause(); }
@Test public void onUpdateTransactionWithNegativeTransactionId_shouldThrowNegativeIndexException() { assertThatExceptionOfType(TransactionDataStore.NegativeIndexException.class) .isThrownBy(new ThrowableAssert.ThrowingCallable() { @Override public void call() { simpleTransactionDataStore.updateTransaction(getHttpTransactionWithIndex(-1)); } }) .withNoCause(); }
@Test public void onUpdateTransactionWithNonExistingTransactionId_shouldReturnFalse() { assertThat(simpleTransactionDataStore.updateTransaction(getHttpTransactionWithIndex(23))).isFalse(); assertThat(simpleTransactionDataStore.updateTransaction(getHttpTransactionWithIndex(200))).isFalse(); }
@Test public void onNonExistingTransactionUpdate_shouldNotCallListener() { simpleTransactionDataStore.updateTransaction(getHttpTransactionWithIndex(1)); verify(dataChangeListener, never()).onDataChange(eq(TransactionDataStore.Event.UPDATED), any(HttpTransaction.class)); }