@Override
public void tearDown() throws Exception {
- // Some tests may call tomcat.destroy(). In which case, don't
- // call stop()
+ // Some tests may call tomcat.destroy(), some tests may just call
+ // tomcat.stop(), smoe not call either method. Make sure that stop() &
+ // destroy() are called as necessary.
if (tomcat.server != null &&
tomcat.server.getState() != LifecycleState.DESTROYED) {
- tomcat.stop();
+ if (tomcat.server.getState() != LifecycleState.STOPPED) {
+ tomcat.stop();
+ }
+ tomcat.destroy();
}
ExpandWar.delete(tempDir);
}