### Question:
TransactionPool { public synchronized ArrayList<Transaction> consume(int limit, HashSet<byte[]> avoid) { ArrayList<Transaction> ret = new ArrayList<Transaction>(); int total = 0; while (!queue.isEmpty()) { Transaction tx = queue.poll(); if (tx != null && !ByteUtil.contains(avoid, tx.getHash())) { ret.add(tx); ++total; } if (total >= limit) { break; } } return ret; } private  TransactionPool(int initialCapacity); static TransactionPool getInstance(); synchronized int inject(Transaction tx); boolean isKnown(byte[] hash); int pending(); void clear(); synchronized void drop(Transaction tx); synchronized ArrayList<Transaction> consume(int limit, HashSet<byte[]> avoid);  }### Answer:
@Test public void consume() { inject(); HashSet<byte[]> avoid = new HashSet<>(); avoid.add(tx2.getHash()); ArrayList<Transaction> ret = pool.consume(10, avoid); Assert.assertEquals(ret.size(), 1); }