Jobs { public static IJobStats getJobStats(Iterable<IScheduledTask> tasks) { JobStats stats = new JobStats(); for (IScheduledTask task : tasks) { updateStats(stats, task.getStatus()); } return IJobStats.build(stats); } private  Jobs(); static IJobStats getJobStats(Iterable<IScheduledTask> tasks);  }
@Test public void testGetJobStats() { ImmutableList<IScheduledTask> tasks = FluentIterable .from(EnumSet.allOf(ScheduleStatus.class)) .transform(status -> addStateTransition(makeTask("id", TaskTestUtil.JOB), status, 100L)).toList(); IJobStats expectedStats = IJobStats.build(new JobStats() .setActiveTaskCount(7) .setFailedTaskCount(2) .setFinishedTaskCount(2) .setPendingTaskCount(3)); assertEquals(expectedStats, Jobs.getJobStats(tasks)); }