RebuildAssetUploadMetadataTaskManager extends LifecycleSupport { @Override protected void doStart() { removeOldRebuildTasks(); } @Inject  RebuildAssetUploadMetadataTaskManager(final TaskScheduler taskScheduler);   }
@Test public void doStartWithNoOldRebuildTasks() throws Exception { when(taskScheduler.listsTasks()).thenReturn(emptyList()); manager.doStart(); verify(taskScheduler, never()).scheduleTask(any(), any()); }
@Test public void doStartRemovedOldTasks() throws Exception { TaskInfo existingTask = createMockTaskInfo(RebuildAssetUploadMetadataTaskDescriptor.TYPE_ID); when(taskScheduler.listsTasks()).thenReturn(asList(existingTask)); manager.doStart(); verify(existingTask).remove(); }