@Test
public void testWaitForOneOf() throws LifecycleException,
    InterruptedException {

  LifecycleAware delegate = new SleeperLifecycleDelegate();
  Assert.assertEquals(LifecycleState.IDLE, delegate.getLifecycleState());
  delegate.start();
  boolean reached = LifecycleController.waitForOneOf(delegate,
      new LifecycleState[] { LifecycleState.STOP, LifecycleState.START },
      2000);
  Assert.assertTrue("Matched a state change", reached);
  Assert.assertEquals(LifecycleState.START, delegate.getLifecycleState());
}