JobScheduleController { public synchronized void resumeJob() { try { if (!scheduler.isShutdown()) { scheduler.resumeAll(); } } catch (final SchedulerException ex) { throw new JobSystemException(ex); } }  void scheduleJob(final String cron); synchronized void rescheduleJob(final String cron); synchronized void rescheduleJob(); synchronized boolean isPaused(); synchronized void pauseJob(); synchronized void resumeJob(); synchronized void triggerJob(); synchronized void shutdown(); synchronized void shutdown(final boolean isCleanShutdown);  }
@Test public void assertResumeJobIfShutdown() throws SchedulerException { when(scheduler.isShutdown()).thenReturn(true); ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); jobScheduleController.resumeJob(); verify(scheduler, times(0)).resumeAll(); }
@Test(expected = JobSystemException.class) public void assertResumeJobFailure() throws SchedulerException { doThrow(SchedulerException.class).when(scheduler).resumeAll(); ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); try { jobScheduleController.resumeJob(); } finally { verify(scheduler).resumeAll(); } }
@Test public void assertResumeJobSuccess() throws SchedulerException { ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); jobScheduleController.resumeJob(); verify(scheduler).resumeAll(); }