OperationQueue { Collection<Operation> toCollection() { ArrayList<Operation> clone = new ArrayList<>(this.elementCount); for (Operation op : this.store) { clone.add(op); } return clone; } 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 toCollection() { 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 = q.toCollection(); assertTrue(ops.size() == this.count); assertTrue(!q.isEmpty()); for (Operation op : ops) { assertEquals(pragma, op.getRequestHeader(Operation.PRAGMA_HEADER)); } q.clear(); assertTrue(q.isEmpty()); }