DefaultLifecycleController implements LifecycleController { @Override public boolean canStop(String phaseName) { return phaseName != null && (phaseName.equals(Startable.PHASE_NAME_END)); }  @Override boolean canInitialize(String phaseName); @Override boolean canStart(String phaseName); @Override boolean canStop(String phaseName); @Override boolean canDispose(String phaseName);  }
@Test public void testCanStop() throws Exception{ Lifecycle lifecycle = new NoOpLifecycleObject(); try{ lifecycle.stop(); Assert.fail(); }catch(Exception e){ } lifecycle.initialize(); try{ lifecycle.stop(); Assert.fail(); }catch(Exception e){ } lifecycle.start(); lifecycle.stop(); lifecycle.dispose(); try{ lifecycle.stop(); Assert.fail(); }catch(Exception e){ } }