/** * @see Daemon#executeScheduledTask(Task) */ @Test public void daemonUser_shouldHaveAssociatedPerson() throws Throwable { try { TestTask task = new TestTask(); new PrivateSchedulerTask(task).runTask(); Assert.assertTrue(true); } catch (NullPointerException e) { Assert.fail("Daemon user should have an associated person"); } }
/** * @see Daemon#runInNewDaemonThread(Runnable) */ @Test public void runInNewDaemonThread_shouldNotThrowErrorIfCalledFromADaemonThread() throws Throwable { Task taskThatStartsAnotherThread = new TaskThatStartsAnotherThread(); Assert.assertTrue(new PrivateSchedulerTask(taskThatStartsAnotherThread).runTheTest()); }
/** * This uses a task that just marks itself as run when its "execute" method is called. This * verifies that the Daemon class is getting past the class check and on to the task running * step * * @see Daemon#executeScheduledTask(Task) */ @Test public void executeScheduledTask_shouldNotThrowErrorIfCalledFromATimerSchedulerTaskClass() throws Throwable { Task task = new PrivateTask(); Assert.assertTrue(new PrivateSchedulerTask(task).runTheTest()); }