OperationQueue { public void transferAll(Collection<Operation> pendingOps) { pendingOps.addAll(this.store); this.store.clear(); } private  OperationQueue(); static OperationQueue createFifo(int limit); static OperationQueue createLifo(int limit); int getLimit(); void setLimit(int limit); boolean isEmpty(); boolean offer(Operation op); Operation poll(); void transferAll(Collection<Operation> pendingOps); void clear(); int size(); Iterator<Operation> iterator();  }
@Test public void transferAll() { OperationQueue q = OperationQueue.createFifo(this.count); final String pragma = UUID.randomUUID().toString(); for (int i = 0; i < this.count; i++) { Operation op = Operation.createPost(null).addPragmaDirective(pragma); q.offer(op); } Collection<Operation> ops = new ArrayList<>(this.count); q.transferAll(ops); assertTrue(ops.size() == this.count); assertTrue(q.isEmpty()); for (Operation op : ops) { assertEquals(pragma, op.getRequestHeader(Operation.PRAGMA_HEADER)); } }