@Test
public void testReadyToTerminate() throws Exception {

  AbstractJobTerminationStateService service = new AbstractJobTerminationStateService() { };
  service.setServiceRegistry(serviceRegistry);
  // jobs running, state NONE
  Assert.assertEquals(false, service.readyToTerminate());
  // jobs running state WAIT
  service.setState(TerminationStateService.TerminationState.WAIT);
  Assert.assertEquals(false, service.readyToTerminate());
  // no jobs running state WAIT
  Assert.assertEquals(true, service.readyToTerminate());
  Assert.assertEquals(TerminationStateService.TerminationState.READY, service.getState());
}