assertEquals(3, queue.getNextTasks(tasks, 3));
assertEquals(2, queue.getNextTasks(tasks, 3));
}
@Test public void addAndConsumeTasksRecurring() throws Exception {
RecurringTaskHandle handle1 =
getRecurringTask().getRecurringTaskHandle();
handle1.start();
RecurringTaskHandle handle2 =
getRecurringTask().getRecurringTaskHandle();
handle2.cancel();
RecurringTaskHandle handle3 =
getRecurringTask().getRecurringTaskHandle();
handle3.start();
handle1.cancel();
handle3.cancel();
LinkedList<ScheduledTask> tasks = new LinkedList<ScheduledTask>();
assertEquals(2, schedulerQueue.getNextTasks(tasks, 6));
Thread.sleep(150);
assertNull(schedulerQueue.getNextTask(false));
}