ProcessCountJob implements Runnable { @Override public void run() { String jobName = jobConfiguration.getJobName(); serverService.persistProcessSuccessCount(ProcessCountStatistics.getProcessSuccessCount(jobName)); serverService.persistProcessFailureCount(ProcessCountStatistics.getProcessFailureCount(jobName)); ProcessCountStatistics.reset(jobName); } ProcessCountJob(final CoordinatorRegistryCenter coordinatorRegistryCenter, final JobConfiguration jobConfiguration); @Override void run();  }
@Test public void assertRun() throws JobExecutionException { ProcessCountStatistics.incrementProcessSuccessCount(ProcessCountJobTest.class.getName()); ProcessCountStatistics.incrementProcessSuccessCount(ProcessCountJobTest.class.getName()); ProcessCountStatistics.incrementProcessFailureCount(ProcessCountJobTest.class.getName()); ProcessCountStatistics.incrementProcessFailureCount(ProcessCountJobTest.class.getName()); ProcessCountStatistics.incrementProcessSuccessCount(ProcessCountJobTest.class.getName() + "_otherTestJob"); ProcessCountStatistics.incrementProcessFailureCount(ProcessCountJobTest.class.getName() + "_otherTestJob"); processCountJob.run(); verify(serverService).persistProcessSuccessCount(2); verify(serverService).persistProcessFailureCount(2); assertThat(ProcessCountStatistics.getProcessSuccessCount(ProcessCountJobTest.class.getName()), is(0)); assertThat(ProcessCountStatistics.getProcessFailureCount(ProcessCountJobTest.class.getName()), is(0)); assertThat(ProcessCountStatistics.getProcessSuccessCount(ProcessCountJobTest.class.getName() + "_otherTestJob"), is(1)); assertThat(ProcessCountStatistics.getProcessFailureCount(ProcessCountJobTest.class.getName() + "_otherTestJob"), is(1)); }