### Question:
FacadeService { public boolean isRunning(final TaskContext taskContext) { return ExecutionType.FAILOVER != taskContext.getType() && !runningService.getRunningTasks(taskContext.getMetaInfo().getJobName()).isEmpty() || ExecutionType.FAILOVER == taskContext.getType() && runningService.isTaskRunning(taskContext.getMetaInfo()); } FacadeService(final CoordinatorRegistryCenter regCenter); void start(); Collection<JobContext> getEligibleJobContext(); void removeLaunchTasksFromQueue(final List<TaskContext> taskContexts); void addRunning(final TaskContext taskContext); void updateDaemonStatus(final TaskContext taskContext, final boolean isIdle); void removeRunning(final TaskContext taskContext); void recordFailoverTask(final TaskContext taskContext); void addTransient(final String jobName); Optional<CloudJobConfiguration> load(final String jobName); Optional<CloudAppConfiguration> loadAppConfig(final String appName); Optional<String> getFailoverTaskId(final TaskContext.MetaInfo metaInfo); void addDaemonJobToReadyQueue(final String jobName); boolean isRunning(final TaskContext taskContext); void addMapping(final String taskId, final String hostname); String popMapping(final String taskId); Map<String, Integer> getAllReadyTasks(); Map<String, Set<TaskContext>> getAllRunningTasks(); Map<String, Collection<FailoverTaskInfo>> getAllFailoverTasks(); boolean isJobDisabled(final String jobName); void enableJob(final String jobName); void disableJob(final String jobName); Collection<MesosStateService.ExecutorStateInfo> loadExecutorInfo(); void stop();  }### Answer:
@Test public void assertIsRunningForReadyJobAndNotRunning() { Mockito.when(runningService.getRunningTasks("test_job")).thenReturn(Collections.<TaskContext>emptyList()); Assert.assertFalse(facadeService.isRunning(TaskContext.from(TaskNode.builder().type(ExecutionType.READY).build().getTaskNodeValue()))); }
@Test public void assertIsRunningForFailoverJobAndNotRunning() { Mockito.when(runningService.isTaskRunning(TaskContext.from(TaskNode.builder().type(ExecutionType.FAILOVER).build().getTaskNodeValue()).getMetaInfo())).thenReturn(false); Assert.assertFalse(facadeService.isRunning(TaskContext.from(TaskNode.builder().type(ExecutionType.FAILOVER).build().getTaskNodeValue()))); }
@Test public void assertIsRunningForFailoverJobAndRunning() { Mockito.when(runningService.isTaskRunning(TaskContext.from(TaskNode.builder().type(ExecutionType.FAILOVER).build().getTaskNodeValue()).getMetaInfo())).thenReturn(true); Assert.assertTrue(facadeService.isRunning(TaskContext.from(TaskNode.builder().type(ExecutionType.FAILOVER).build().getTaskNodeValue()))); }