### Question:
SimpleTransactionDataStore implements TransactionDataStore { @Override public boolean removeTransactionWithIndex(long index) { guardForZeroAndNegativeIndices(index); if (data.containsKey(index)) { HttpTransaction deletedTransaction = data.get(index); data.remove(index); sendDataChangeEvent(Event.DELETED, deletedTransaction); 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 onRemoveTransactionWithZeroTransactionId_shouldThrowZeroIndexException() { assertThatExceptionOfType(TransactionDataStore.ZeroIndexException.class) .isThrownBy(new ThrowableAssert.ThrowingCallable() { @Override public void call() { simpleTransactionDataStore.removeTransactionWithIndex(0); } }) .withNoCause(); }
@Test public void onRemoveTransactionWithNegativeTransactionId_shouldThrowNegativeIndexException() { assertThatExceptionOfType(TransactionDataStore.NegativeIndexException.class) .isThrownBy(new ThrowableAssert.ThrowingCallable() { @Override public void call() { simpleTransactionDataStore.removeTransactionWithIndex(-1); } }) .withNoCause(); }
@Test public void onDeleteTransactionWithNonExistingTransactionId_shouldReturnFalse() { assertThat(simpleTransactionDataStore.removeTransactionWithIndex(23)).isFalse(); assertThat(simpleTransactionDataStore.removeTransactionWithIndex(200)).isFalse(); }
@Test public void onNonExistingTransactionDelete_shouldNotCallListener() { simpleTransactionDataStore.removeTransactionWithIndex(1); verify(dataChangeListener, never()).onDataChange(eq(TransactionDataStore.Event.DELETED), any(HttpTransaction.class)); }