@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());
}