DefaultLifecycleController implements LifecycleController { @Override public boolean canDispose(String phaseName) { return phaseName != null && (phaseName.equals(Initializable.PHASE_NAME_END) || phaseName.equals(Stoppable.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 testCanDispose() throws Exception{ Lifecycle lifecycle = new NoOpLifecycleObject(); try{ lifecycle.dispose(); Assert.fail(); }catch(Exception e){ } lifecycle.initialize(); lifecycle.dispose(); lifecycle.initialize(); lifecycle.start(); try{ lifecycle.dispose(); Assert.fail(); }catch(Exception e){ } lifecycle.stop(); lifecycle.dispose(); try{ lifecycle.dispose(); Assert.fail(); }catch(Exception e){ } }