// submit three tasks
executorFront2.execute(slowTask);
executorFront2.execute(countTask);
executorFront2.execute(slowTask);
Assert.assertEquals(mockExecutor.getNumPendingTasks(), 2);
AnnotatedRunnable drainer2 = mockExecutor.getRunnableList().get(1);
mockExecutor.removeHead().run();
// Drainer1 expires after the 1st task completes,
// and is rescheduled to the end of the pending list.
Assert.assertEquals(mockExecutor.getNumPendingTasks(), 2);
// Drainer2 should be on the head of the pending list
Assert.assertSame(drainer2, mockExecutor.getRunnableList().get(0));
mockExecutor.removeHead().run();
// Drainer2 expires after the 2nd and 3rd task complete.
AnnotatedRunnable drainer1 = mockExecutor.getRunnableList().get(0);
// Drainer1 should be on the head of the pending list
Assert.assertNotSame(drainer1, drainer2);
// should have 2 slow tasks and 1 count tasks