@Test public void testWaitForState() throws LifecycleException, InterruptedException { LifecycleAware delegate = new SleeperLifecycleDelegate(); Assert.assertTrue(delegate.getLifecycleState().equals(LifecycleState.IDLE)); delegate.start(); boolean reached = LifecycleController.waitForState(delegate, LifecycleState.START, 2000); Assert.assertEquals(true, reached); Assert.assertEquals(LifecycleState.START, delegate.getLifecycleState()); delegate.stop(); reached = LifecycleController.waitForState(delegate, LifecycleState.STOP, 2000); Assert.assertEquals(true, reached); Assert.assertEquals(LifecycleState.STOP, delegate.getLifecycleState()); delegate.start(); reached = LifecycleController.waitForState(delegate, LifecycleState.IDLE, 500); Assert.assertEquals(false, reached); Assert.assertEquals(LifecycleState.START, delegate.getLifecycleState()); }
public static boolean waitForState(LifecycleAware delegate, LifecycleState state) throws InterruptedException { return waitForState(delegate, state, 0); }
LifecycleController { public static boolean waitForState(LifecycleAware delegate, LifecycleState state) throws InterruptedException { return waitForState(delegate, state, 0); } }
LifecycleController { public static boolean waitForState(LifecycleAware delegate, LifecycleState state) throws InterruptedException { return waitForState(delegate, state, 0); }  }
LifecycleController { public static boolean waitForState(LifecycleAware delegate, LifecycleState state) throws InterruptedException { return waitForState(delegate, state, 0); }  static boolean waitForState(LifecycleAware delegate,
      LifecycleState state); static boolean waitForState(LifecycleAware delegate,
      LifecycleState state, long timeout); static boolean waitForOneOf(LifecycleAware delegate,
      LifecycleState[] states); static boolean waitForOneOf(LifecycleAware delegate,
      LifecycleState[] states, long timeout); static void stopAll(List<LifecycleAware> services); }
LifecycleController { public static boolean waitForState(LifecycleAware delegate, LifecycleState state) throws InterruptedException { return waitForState(delegate, state, 0); }  static boolean waitForState(LifecycleAware delegate,
      LifecycleState state); static boolean waitForState(LifecycleAware delegate,
      LifecycleState state, long timeout); static boolean waitForOneOf(LifecycleAware delegate,
      LifecycleState[] states); static boolean waitForOneOf(LifecycleAware delegate,
      LifecycleState[] states, long timeout); static void stopAll(List<LifecycleAware> services);  }