@Test
public void testLifeCyclePolling() throws Exception {

  // change termination state
  service.setState(TerminationStateServiceImpl.TerminationState.WAIT);
  Assert.assertEquals(TerminationStateServiceImpl.TerminationState.WAIT, service.getState());
  Thread.sleep(3000);
  String[] trigger = scheduler.getTriggerNames(TerminationStateServiceImpl.SCHEDULE_GROUP);
  Assert.assertEquals(1, trigger.length);
  Assert.assertEquals(TerminationStateServiceImpl.SCHEDULE_JOB_POLLING_TRIGGER, trigger[0]);
  // complete running jobs
  nRunningJobs = 0L;
  Thread.sleep(3000);
  trigger = scheduler.getTriggerNames(TerminationStateServiceImpl.SCHEDULE_GROUP);
  Assert.assertEquals(0, trigger.length);
  Assert.assertEquals(TerminationStateServiceImpl.TerminationState.READY, service.getState());
}