Skip to content

Commit 0900245

Browse files
committed
Merge pull request #44447 from izeye
* pr/44447: Polish Closes gh-44447
2 parents 80cc1f5 + 3a5e059 commit 0900245

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

Diff for: spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureBefore.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
public @interface AutoConfigureBefore {
4545

4646
/**
47-
* The auto-configure classes that should have not yet been applied.
47+
* The auto-configuration classes that should have not yet been applied.
4848
* @return the classes
4949
*/
5050
Class<?>[] value() default {};

Diff for: spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContext.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,15 @@ public final void refresh() throws BeansException, IllegalStateException {
146146
super.refresh();
147147
}
148148
catch (RuntimeException ex) {
149-
try {
150-
WebServer webServer = this.webServer;
151-
if (webServer != null) {
149+
WebServer webServer = this.webServer;
150+
if (webServer != null) {
151+
try {
152152
webServer.stop();
153153
webServer.destroy();
154154
}
155-
}
156-
catch (RuntimeException stopOrDestroyEx) {
157-
ex.addSuppressed(stopOrDestroyEx);
155+
catch (RuntimeException stopOrDestroyEx) {
156+
ex.addSuppressed(stopOrDestroyEx);
157+
}
158158
}
159159
throw ex;
160160
}

Diff for: spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/context/ReactiveWebServerApplicationContextTests.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
4545
import static org.mockito.BDDMockito.then;
4646
import static org.mockito.BDDMockito.willThrow;
47+
import static org.mockito.Mockito.never;
4748
import static org.mockito.Mockito.times;
4849

4950
/**
@@ -148,7 +149,7 @@ void whenContextRefreshFailedThenWebServerStopFailedCatchStopException() {
148149
.withStackTraceContaining("WebServer has failed to stop");
149150
WebServer webServer = this.context.getWebServer();
150151
then(webServer).should().stop();
151-
then(webServer).should(times(0)).destroy();
152+
then(webServer).should(never()).destroy();
152153
}
153154

154155
@Test

Diff for: spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContextTests.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
import static org.mockito.Mockito.atMost;
8787
import static org.mockito.Mockito.inOrder;
8888
import static org.mockito.Mockito.mock;
89+
import static org.mockito.Mockito.never;
8990
import static org.mockito.Mockito.times;
9091
import static org.mockito.Mockito.withSettings;
9192

@@ -236,7 +237,7 @@ void whenContextRefreshFailedThenWebServerStopFailedCatchStopException() {
236237
.withStackTraceContaining("WebServer has failed to stop");
237238
WebServer webServer = this.context.getWebServer();
238239
then(webServer).should().stop();
239-
then(webServer).should(times(0)).destroy();
240+
then(webServer).should(never()).destroy();
240241
}
241242

242243
@Test

Diff for: spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
import static org.mockito.BDDMockito.then;
167167
import static org.mockito.Mockito.inOrder;
168168
import static org.mockito.Mockito.mock;
169-
import static org.mockito.Mockito.times;
169+
import static org.mockito.Mockito.never;
170170

171171
/**
172172
* Base for testing classes that extends {@link AbstractServletWebServerFactory}.
@@ -1195,7 +1195,7 @@ protected void servletContextListenerContextDestroyedIsNotCalledWhenContainerIsS
11951195
this.webServer = getFactory().getWebServer((servletContext) -> servletContext.addListener(listener));
11961196
this.webServer.start();
11971197
this.webServer.stop();
1198-
then(listener).should(times(0)).contextDestroyed(any(ServletContextEvent.class));
1198+
then(listener).should(never()).contextDestroyed(any(ServletContextEvent.class));
11991199
}
12001200

12011201
@Test

0 commit comments

Comments
 (0)