@Test public void duplicatesRemoved() { TaskInfo nameMismatch = mockTask("foo", CleanupBootService.CRON); TaskInfo cronMismatch = mockTask(CleanupBootService.TASK_NAME, "1 0 1 * * ?"); TaskInfo scheduleMismatch = mock(TaskInfo.class); when(scheduleMismatch.getConfiguration()).thenReturn(taskConfig); when(scheduleMismatch.getName()).thenReturn(CleanupBootService.TASK_NAME); TaskInfo matchA = mockTask(CleanupBootService.TASK_NAME, CleanupBootService.CRON); TaskInfo matchB = mockTask(CleanupBootService.TASK_NAME, CleanupBootService.CRON); List<TaskInfo> tasks = ImmutableList.of(nameMismatch, cronMismatch, scheduleMismatch, matchA, matchB); when(taskScheduler.listsTasks()).thenReturn(tasks); underTest.doStart(); verify(nameMismatch, never()).remove(); verify(cronMismatch, never()).remove(); verify(scheduleMismatch, never()).remove(); verify(matchA, never()).remove(); verify(matchB).remove(); }
@Override protected void doStart() { createCleanupTask(); }
CleanupBootService extends LifecycleSupport { @Override protected void doStart() { createCleanupTask(); } }
CleanupBootService extends LifecycleSupport { @Override protected void doStart() { createCleanupTask(); } @Inject  CleanupBootService(final TaskScheduler taskScheduler); }
CleanupBootService extends LifecycleSupport { @Override protected void doStart() { createCleanupTask(); } @Inject  CleanupBootService(final TaskScheduler taskScheduler);  }
CleanupBootService extends LifecycleSupport { @Override protected void doStart() { createCleanupTask(); } @Inject  CleanupBootService(final TaskScheduler taskScheduler);   }