@Test
public void testHostsBeingRemovedFromPriorityList() throws Exception {

  serviceRegistryJpaImpl.dispatchPriorityList.put(0L, TEST_HOST);
  Job testJob = serviceRegistryJpaImpl.createJob(TEST_HOST, TEST_SERVICE_2, TEST_OPERATION, null, null, true, null);
  JobBarrier barrier = new JobBarrier(null, serviceRegistryJpaImpl, testJob);
  launchDispatcherOnce(false);
  try {
    barrier.waitForJobs(JOB_BARRIER_TIMEOUT);
    Assert.fail("Did not receive a timeout exception");
  } catch (Exception e) {
    Assert.assertEquals(0, serviceRegistryJpaImpl.dispatchPriorityList.size());
  } finally {
    logger.debug("end testHostsBeingRemovedFromPriorityList");
  }
}