Tomcat7DeltaSessionManager extends DeltaSessionManager<Tomcat7CommitSessionValve> { @Override public void stopInternal() throws LifecycleException { stopInternalBase(); if (getLogger().isDebugEnabled()) { getLogger().debug(this + ": Stopping"); } try { unload(); } catch (IOException e) { getLogger().error("Unable to unload sessions", e); } this.started.set(false); this.lifecycle.fireLifecycleEvent(STOP_EVENT, null); super.destroyInternal(); getSessionsToTouch().clear(); cancelTimer(); unregisterJvmRouteBinderValve(); if (isCommitValveEnabled()) { unregisterCommitSessionValve(); } setLifecycleState(LifecycleState.STOPPING); }  @Override void startInternal(); @Override void stopInternal(); @Override void addLifecycleListener(LifecycleListener listener); @Override LifecycleListener[] findLifecycleListeners(); @Override void removeLifecycleListener(LifecycleListener listener);  }
@Test public void stopInternal() throws LifecycleException, IOException { doNothing().when((Tomcat7DeltaSessionManager) manager).startInternalBase(); doNothing().when((Tomcat7DeltaSessionManager) manager).destroyInternalBase(); doReturn(true).when(manager).isCommitValveEnabled(); doNothing().when(manager).unload(); doNothing().when((Tomcat7DeltaSessionManager) manager) .setLifecycleState(LifecycleState.STOPPING); ((Tomcat7DeltaSessionManager) manager).stopInternal(); assertThat(manager.started).isFalse(); verify((Tomcat7DeltaSessionManager) manager).setLifecycleState(LifecycleState.STOPPING); }