diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactoryTests.java index 68db29755a..48e3b2fe10 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactoryTests.java @@ -33,7 +33,7 @@ import org.springframework.http.server.reactive.HttpHandler; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.doAnswer; +import static org.mockito.BDDMockito.willAnswer; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -72,7 +72,7 @@ public class TomcatReactiveWebServerFactoryTests public void contextIsAddedToHostBeforeCustomizersAreCalled() throws Exception { TomcatReactiveWebServerFactory factory = getFactory(); TomcatContextCustomizer customizer = mock(TomcatContextCustomizer.class); - doAnswer(new Answer() { + willAnswer(new Answer() { @Override public Void answer(InvocationOnMock invocation) throws Throwable { @@ -81,7 +81,7 @@ public class TomcatReactiveWebServerFactoryTests return null; } - }).when(customizer).customize(any(Context.class)); + }).given(customizer).customize(any(Context.class)); factory.addContextCustomizers(customizer); this.webServer = factory.getWebServer(mock(HttpHandler.class)); verify(customizer).customize(any(Context.class)); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java index e8335c8aca..a533f8cc27 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java @@ -63,7 +63,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.doAnswer; +import static org.mockito.BDDMockito.willAnswer; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -150,7 +150,7 @@ public class TomcatServletWebServerFactoryTests public void contextIsAddedToHostBeforeCustomizersAreCalled() throws Exception { TomcatServletWebServerFactory factory = getFactory(); TomcatContextCustomizer customizer = mock(TomcatContextCustomizer.class); - doAnswer(new Answer() { + willAnswer(new Answer() { @Override public Void answer(InvocationOnMock invocation) throws Throwable { @@ -159,7 +159,7 @@ public class TomcatServletWebServerFactoryTests return null; } - }).when(customizer).customize(any(Context.class)); + }).given(customizer).customize(any(Context.class)); factory.addContextCustomizers(customizer); this.webServer = factory.getWebServer(); verify(customizer).customize(any(Context.class));