@Test(expected = IllegalArgumentException.class) public void testAddShouldThrowException() { TransactionsPool transactionsProcessed = new TransactionsPool(); transactionsProcessed.addBlock(null); }
public void addBlock(Block block) { Util.check(block != null, "block != null"); if (BlockUtil.isEmptyBlock(block)) { return; } Object dummyObject = new Object(); synchronized (locker) { Collection<String> hashes = BlockUtil.getTransactionsHashesAsString(block); for (String hash : hashes) { lastTransactions.put(hash, dummyObject); } transactions.removeAll(hashes); } }
TransactionsPool { public void addBlock(Block block) { Util.check(block != null, "block != null"); if (BlockUtil.isEmptyBlock(block)) { return; } Object dummyObject = new Object(); synchronized (locker) { Collection<String> hashes = BlockUtil.getTransactionsHashesAsString(block); for (String hash : hashes) { lastTransactions.put(hash, dummyObject); } transactions.removeAll(hashes); } } }
TransactionsPool { public void addBlock(Block block) { Util.check(block != null, "block != null"); if (BlockUtil.isEmptyBlock(block)) { return; } Object dummyObject = new Object(); synchronized (locker) { Collection<String> hashes = BlockUtil.getTransactionsHashesAsString(block); for (String hash : hashes) { lastTransactions.put(hash, dummyObject); } transactions.removeAll(hashes); } }  }
TransactionsPool { public void addBlock(Block block) { Util.check(block != null, "block != null"); if (BlockUtil.isEmptyBlock(block)) { return; } Object dummyObject = new Object(); synchronized (locker) { Collection<String> hashes = BlockUtil.getTransactionsHashesAsString(block); for (String hash : hashes) { lastTransactions.put(hash, dummyObject); } transactions.removeAll(hashes); } }  List<String> getTransactions(); boolean addTransaction(String transactionHash); boolean checkExists(String transactionHash); void addBlock(Block block); }
TransactionsPool { public void addBlock(Block block) { Util.check(block != null, "block != null"); if (BlockUtil.isEmptyBlock(block)) { return; } Object dummyObject = new Object(); synchronized (locker) { Collection<String> hashes = BlockUtil.getTransactionsHashesAsString(block); for (String hash : hashes) { lastTransactions.put(hash, dummyObject); } transactions.removeAll(hashes); } }  List<String> getTransactions(); boolean addTransaction(String transactionHash); boolean checkExists(String transactionHash); void addBlock(Block block);  }