### Question:
FailoverService { public Collection<JobContext> getAllEligibleJobContexts() { if (!regCenter.isExisted(FailoverNode.ROOT)) { return Collections.emptyList(); } List<String> jobNames = regCenter.getChildrenKeys(FailoverNode.ROOT); Collection<JobContext> result = new ArrayList<>(jobNames.size()); Set<HashCode> assignedTasks = new HashSet<>(jobNames.size() * 10, 1); for (String each : jobNames) { List<String> taskIdList = regCenter.getChildrenKeys(FailoverNode.getFailoverJobNodePath(each)); if (taskIdList.isEmpty()) { regCenter.remove(FailoverNode.getFailoverJobNodePath(each)); continue; } Optional<CloudJobConfiguration> jobConfig = configService.load(each); if (!jobConfig.isPresent()) { regCenter.remove(FailoverNode.getFailoverJobNodePath(each)); continue; } List<Integer> assignedShardingItems = getAssignedShardingItems(each, taskIdList, assignedTasks); if (!assignedShardingItems.isEmpty() && jobConfig.isPresent()) { result.add(new JobContext(jobConfig.get(), assignedShardingItems, ExecutionType.FAILOVER)); } } return result; } FailoverService(final CoordinatorRegistryCenter regCenter); void add(final TaskContext taskContext); Collection<JobContext> getAllEligibleJobContexts(); void remove(final Collection<TaskContext.MetaInfo> metaInfoList); Optional<String> getTaskId(final TaskContext.MetaInfo metaInfo); Map<String, Collection<FailoverTaskInfo>> getAllFailoverTasks();  }### Answer:
@Test public void assertGetAllEligibleJobContextsWithoutRootNode() { Mockito.when(regCenter.isExisted("/state/failover")).thenReturn(false); Assert.assertTrue(failoverService.getAllEligibleJobContexts().isEmpty()); Mockito.verify(regCenter).isExisted("/state/failover"); }