@Test public void onDeleteTransactionWithNonExistingTransactionId_shouldReturnFalse() { assertThat(simpleTransactionDataStore.removeTransactionWithIndex(23)).isFalse(); assertThat(simpleTransactionDataStore.removeTransactionWithIndex(200)).isFalse(); }
@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 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 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(); }
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); }
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);  }