public void testSubmitsAreSequential() throws Exception {

    SynchronousQueueService queueService = new SynchronousQueueService(m_bundleContext);

    queueService.submit(new StringCallable("one"), m_callback, null);
    queueService.submit(new StringCallable("two"), m_callback, null);

    InOrder order = inOrder(m_callback);
    order.verify(m_callback).success(infos.capture(), eq("one"));
    order.verify(m_callback).success(infos.capture(), eq("two"));

    JobInfo one = infos.getAllValues().get(0);
    JobInfo two = infos.getAllValues().get(1);

    assertTrue(two.getEnlistmentTime() >= one.getEndTime());
  }
  public void testRegistration() throws Exception {
    SynchronousQueueService queueService = new SynchronousQueueService(m_bundleContext);

    Mockito.<ServiceRegistration<?>>when(
            m_bundleContext.registerService(
                eq(QueueService.class.getName()), eq(queueService), any(Dictionary.class)))
        .thenReturn(m_registration);

    queueService.start();

    verify(m_bundleContext)
        .registerService(eq(QueueService.class.getName()), eq(queueService), any(Dictionary.class));

    queueService.stop();

    verify(m_registration).unregister();
  }