@Test public void scheduleTest() { TestPriorityScheduler testScheduler = new TestPriorityScheduler(); PrioritySchedulerDefaultPriorityWrapper psw = new PrioritySchedulerDefaultPriorityWrapper(testScheduler, TaskPriority.Low); psw.schedule(DoNothingRunnable.instance(), 10); assertTrue(testScheduler.scheduleCalled); // reset and try with priority testScheduler.scheduleCalled = false; psw.schedule(DoNothingRunnable.instance(), 10, TaskPriority.High); assertTrue(testScheduler.scheduleCalled); }
@Test public void submitRunnableWithResultTest() { TestPriorityScheduler testScheduler = new TestPriorityScheduler(); PrioritySchedulerDefaultPriorityWrapper psw = new PrioritySchedulerDefaultPriorityWrapper(testScheduler, TaskPriority.Low); psw.submit(DoNothingRunnable.instance(), new Object()); assertTrue(testScheduler.submitRunnableResultCalled); // reset and try with priority testScheduler.submitRunnableResultCalled = false; psw.submit(DoNothingRunnable.instance(), new Object(), TaskPriority.High); assertTrue(testScheduler.submitRunnableResultCalled); }
@Test public void submitScheduledCallableTest() { TestPriorityScheduler testScheduler = new TestPriorityScheduler(); PrioritySchedulerDefaultPriorityWrapper psw = new PrioritySchedulerDefaultPriorityWrapper(testScheduler, TaskPriority.Low); psw.submitScheduled(new TestCallable(), 10); assertTrue(testScheduler.submitScheduledCallableCalled); // reset and try with priority testScheduler.submitScheduledCallableCalled = false; psw.submitScheduled(new TestCallable(), 10, TaskPriority.High); assertTrue(testScheduler.submitScheduledCallableCalled); }