committed by
Stéphane Nicoll
parent
80cc1f5a0e
commit
3a5e059387
@@ -44,7 +44,7 @@ import org.springframework.context.annotation.DependsOn;
|
||||
public @interface AutoConfigureBefore {
|
||||
|
||||
/**
|
||||
* The auto-configure classes that should have not yet been applied.
|
||||
* The auto-configuration classes that should have not yet been applied.
|
||||
* @return the classes
|
||||
*/
|
||||
Class<?>[] value() default {};
|
||||
|
||||
@@ -146,15 +146,15 @@ public class ServletWebServerApplicationContext extends GenericWebApplicationCon
|
||||
super.refresh();
|
||||
}
|
||||
catch (RuntimeException ex) {
|
||||
try {
|
||||
WebServer webServer = this.webServer;
|
||||
if (webServer != null) {
|
||||
WebServer webServer = this.webServer;
|
||||
if (webServer != null) {
|
||||
try {
|
||||
webServer.stop();
|
||||
webServer.destroy();
|
||||
}
|
||||
}
|
||||
catch (RuntimeException stopOrDestroyEx) {
|
||||
ex.addSuppressed(stopOrDestroyEx);
|
||||
catch (RuntimeException stopOrDestroyEx) {
|
||||
ex.addSuppressed(stopOrDestroyEx);
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||
import static org.mockito.BDDMockito.then;
|
||||
import static org.mockito.BDDMockito.willThrow;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.times;
|
||||
|
||||
/**
|
||||
@@ -148,7 +149,7 @@ class ReactiveWebServerApplicationContextTests {
|
||||
.withStackTraceContaining("WebServer has failed to stop");
|
||||
WebServer webServer = this.context.getWebServer();
|
||||
then(webServer).should().stop();
|
||||
then(webServer).should(times(0)).destroy();
|
||||
then(webServer).should(never()).destroy();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -86,6 +86,7 @@ import static org.mockito.BDDMockito.willThrow;
|
||||
import static org.mockito.Mockito.atMost;
|
||||
import static org.mockito.Mockito.inOrder;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.withSettings;
|
||||
|
||||
@@ -236,7 +237,7 @@ class ServletWebServerApplicationContextTests {
|
||||
.withStackTraceContaining("WebServer has failed to stop");
|
||||
WebServer webServer = this.context.getWebServer();
|
||||
then(webServer).should().stop();
|
||||
then(webServer).should(times(0)).destroy();
|
||||
then(webServer).should(never()).destroy();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -166,7 +166,7 @@ import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.BDDMockito.then;
|
||||
import static org.mockito.Mockito.inOrder;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.never;
|
||||
|
||||
/**
|
||||
* Base for testing classes that extends {@link AbstractServletWebServerFactory}.
|
||||
@@ -1195,7 +1195,7 @@ public abstract class AbstractServletWebServerFactoryTests {
|
||||
this.webServer = getFactory().getWebServer((servletContext) -> servletContext.addListener(listener));
|
||||
this.webServer.start();
|
||||
this.webServer.stop();
|
||||
then(listener).should(times(0)).contextDestroyed(any(ServletContextEvent.class));
|
||||
then(listener).should(never()).contextDestroyed(any(ServletContextEvent.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user