@Test public void onFetchTransactionWithNegativeTransactionId_shouldThrowNegativeIndexException() { assertThatExceptionOfType(TransactionDataStore.NegativeIndexException.class) .isThrownBy(new ThrowableAssert.ThrowingCallable() { @Override public void call() { simpleTransactionDataStore.getTransactionWithId(-1); } }) .withNoCause(); }
@Override public HttpTransaction getTransactionWithId(long id) { guardForZeroAndNegativeIndices(id); if (data.containsKey(id)) { return data.get(id); } throw new IndexDoesNotExistException(); }
SimpleTransactionDataStore implements TransactionDataStore { @Override public HttpTransaction getTransactionWithId(long id) { guardForZeroAndNegativeIndices(id); if (data.containsKey(id)) { return data.get(id); } throw new IndexDoesNotExistException(); } }
SimpleTransactionDataStore implements TransactionDataStore { @Override public HttpTransaction getTransactionWithId(long id) { guardForZeroAndNegativeIndices(id); if (data.containsKey(id)) { return data.get(id); } throw new IndexDoesNotExistException(); } SimpleTransactionDataStore(); }
SimpleTransactionDataStore implements TransactionDataStore { @Override public HttpTransaction getTransactionWithId(long id) { guardForZeroAndNegativeIndices(id); if (data.containsKey(id)) { return data.get(id); } throw new IndexDoesNotExistException(); } 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 HttpTransaction getTransactionWithId(long id) { guardForZeroAndNegativeIndices(id); if (data.containsKey(id)) { return data.get(id); } throw new IndexDoesNotExistException(); } 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);  }