@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 removeRunnableTest() { TestPriorityScheduler testScheduler = new TestPriorityScheduler(); PrioritySchedulerDefaultPriorityWrapper psw = new PrioritySchedulerDefaultPriorityWrapper(testScheduler, TaskPriority.Low); psw.remove(DoNothingRunnable.instance()); assertTrue(testScheduler.removeRunnableCalled); }