QueuedExecutions { public Pair<ExecutionReference, ExecutableFlow> fetchHead() throws InterruptedException { final Pair<ExecutionReference, ExecutableFlow> pair = this.queuedFlowList.take(); if (pair != null && pair.getFirst() != null) { this.queuedFlowMap.remove(pair.getFirst().getExecId()); } return pair; } QueuedExecutions(final long capacity); Pair<ExecutionReference, ExecutableFlow> fetchHead(); void dequeue(final int executionId); void enqueue(final ExecutableFlow exflow, final ExecutionReference ref); void enqueueAll(
      final Collection<Pair<ExecutionReference, ExecutableFlow>> collection); Collection<Pair<ExecutionReference, ExecutableFlow>> getAllEntries(); boolean hasExecution(final int executionId); ExecutableFlow getFlow(final int executionId); ExecutionReference getReference(final int executionId); long size(); boolean isFull(); boolean isEmpty(); void clear();  }
@Test public void testFetchHead() throws IOException, ExecutorManagerException, InterruptedException { final QueuedExecutions queue = new QueuedExecutions(5); final List<Pair<ExecutionReference, ExecutableFlow>> dataList = getDummyData(); Assert.assertTrue(queue.isEmpty()); queue.enqueueAll(dataList); Assert.assertEquals(queue.fetchHead(), dataList.get(0)); Assert.assertEquals(queue.fetchHead(), dataList.get(1)); }