### Question:
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);  }### Answer:
@Test public void onAddTransactionWithZeroTransactionId_shouldThrowIllegalStateException() { assertThatExceptionOfType(TransactionDataStore.ZeroIndexException.class) .isThrownBy(new ThrowableAssert.ThrowingCallable() { @Override public void call() { simpleTransactionDataStore.addTransaction(getHttpTransactionWithZeroIndex()); } }) .withNoCause(); }
@Test public void onAddTransactionWithNegativeTransactionId_shouldThrowIllegalStateException() { assertThatExceptionOfType(TransactionDataStore.NegativeIndexException.class) .isThrownBy(new ThrowableAssert.ThrowingCallable() { @Override public void call() { simpleTransactionDataStore.addTransaction(getHttpTransactionWithIndex(-1)); } }) .withNoCause(); }
@Test public void onAddTransaction_shouldCallListener() { HttpTransaction httpTransaction = getHttpTransactionWithIndex(1); simpleTransactionDataStore.addTransaction(httpTransaction); verify(dataChangeListener, only()).onDataChange(TransactionDataStore.Event.ADDED, httpTransaction); }