Commit 426ef749 authored by Johnny Lim's avatar Johnny Lim Committed by Stephane Nicoll

Polish

See gh-17413
parent 939a247d
...@@ -21,7 +21,6 @@ import org.apache.catalina.connector.Connector; ...@@ -21,7 +21,6 @@ import org.apache.catalina.connector.Connector;
import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.Tomcat;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import reactor.netty.http.server.HttpServer; import reactor.netty.http.server.HttpServer;
import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.AutoConfigurations;
...@@ -275,7 +274,7 @@ class ReactiveWebServerFactoryAutoConfigurationTests { ...@@ -275,7 +274,7 @@ class ReactiveWebServerFactoryAutoConfigurationTests {
@Bean @Bean
HttpHandler httpHandler() { HttpHandler httpHandler() {
return Mockito.mock(HttpHandler.class); return mock(HttpHandler.class);
} }
} }
...@@ -285,7 +284,7 @@ class ReactiveWebServerFactoryAutoConfigurationTests { ...@@ -285,7 +284,7 @@ class ReactiveWebServerFactoryAutoConfigurationTests {
@Bean @Bean
HttpHandler additionalHttpHandler() { HttpHandler additionalHttpHandler() {
return Mockito.mock(HttpHandler.class); return mock(HttpHandler.class);
} }
} }
......
...@@ -46,7 +46,7 @@ public final class DevToolsEnablementDeducer { ...@@ -46,7 +46,7 @@ public final class DevToolsEnablementDeducer {
* Checks if a specific {@link StackTraceElement} in the current thread's stacktrace * Checks if a specific {@link StackTraceElement} in the current thread's stacktrace
* should cause devtools to be disabled. * should cause devtools to be disabled.
* @param thread the current thread * @param thread the current thread
* @return {@code true} if devtools should be enabled skipped * @return {@code true} if devtools should be enabled
*/ */
public static boolean shouldEnable(Thread thread) { public static boolean shouldEnable(Thread thread) {
for (StackTraceElement element : thread.getStackTrace()) { for (StackTraceElement element : thread.getStackTrace()) {
......
...@@ -1982,7 +1982,7 @@ following information: ...@@ -1982,7 +1982,7 @@ following information:
|`status` |`status`
|Response's HTTP status code if available (for example, `200` or `500`), |Response's HTTP status code if available (for example, `200` or `500`),
or `IO_ERROR` in case or I/O issues, `CLIENT_ERROR` otherwise or `IO_ERROR` in case of I/O issues, `CLIENT_ERROR` otherwise
|`uri` |`uri`
|Request's URI template prior to variable substitution, if possible (for example, |Request's URI template prior to variable substitution, if possible (for example,
......
...@@ -3560,12 +3560,12 @@ The following code shows a typical example: ...@@ -3560,12 +3560,12 @@ The following code shows a typical example:
public MyService(RSocketRequester.Builder rsocketRequesterBuilder) { public MyService(RSocketRequester.Builder rsocketRequesterBuilder) {
this.rsocketRequester = rsocketRequesterBuilder this.rsocketRequester = rsocketRequesterBuilder
.connectTcp("example.org", 9090).block(); .connectTcp("example.org", 9090).block();
} }
public Mono<User> someRSocketCall(String name) { public Mono<User> someRSocketCall(String name) {
return this.requester.route("user").data(payload) return this.requester.route("user").data(name)
.retrieveMono(User.class); .retrieveMono(User.class);
} }
} }
......
...@@ -191,7 +191,7 @@ public class SpringBootTestContextBootstrapper extends DefaultTestContextBootstr ...@@ -191,7 +191,7 @@ public class SpringBootTestContextBootstrapper extends DefaultTestContextBootstr
* Determines the resource base path for web applications using the value of * Determines the resource base path for web applications using the value of
* {@link WebAppConfiguration @WebAppConfiguration}, if any, on the test class of the * {@link WebAppConfiguration @WebAppConfiguration}, if any, on the test class of the
* given {@code configuration}. Defaults to {@code src/main/webapp} in its absence. * given {@code configuration}. Defaults to {@code src/main/webapp} in its absence.
* @param configuration the configure to examine * @param configuration the configuration to examine
* @return the resource base path * @return the resource base path
* @since 2.1.6 * @since 2.1.6
*/ */
......
...@@ -23,7 +23,6 @@ import java.util.Set; ...@@ -23,7 +23,6 @@ import java.util.Set;
import org.mockito.Answers; import org.mockito.Answers;
import org.mockito.MockSettings; import org.mockito.MockSettings;
import org.mockito.Mockito;
import org.springframework.core.ResolvableType; import org.springframework.core.ResolvableType;
import org.springframework.core.style.ToStringCreator; import org.springframework.core.style.ToStringCreator;
...@@ -32,6 +31,8 @@ import org.springframework.util.ClassUtils; ...@@ -32,6 +31,8 @@ import org.springframework.util.ClassUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import static org.mockito.Mockito.mock;
/** /**
* A complete definition that can be used to create a Mockito mock. * A complete definition that can be used to create a Mockito mock.
* *
...@@ -150,7 +151,7 @@ class MockDefinition extends Definition { ...@@ -150,7 +151,7 @@ class MockDefinition extends Definition {
if (this.serializable) { if (this.serializable) {
settings.serializable(); settings.serializable();
} }
return (T) Mockito.mock(this.typeToMock.resolve(), settings); return (T) mock(this.typeToMock.resolve(), settings);
} }
} }
...@@ -28,6 +28,8 @@ import org.springframework.util.Assert; ...@@ -28,6 +28,8 @@ import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import static org.mockito.Mockito.mock;
/** /**
* A complete definition that can be used to create a Mockito spy. * A complete definition that can be used to create a Mockito spy.
* *
...@@ -98,7 +100,7 @@ class SpyDefinition extends Definition { ...@@ -98,7 +100,7 @@ class SpyDefinition extends Definition {
if (this.isProxyTargetAware()) { if (this.isProxyTargetAware()) {
settings.verificationStartedListeners(new SpringAopBypassingVerificationStartedListener()); settings.verificationStartedListeners(new SpringAopBypassingVerificationStartedListener());
} }
return (T) Mockito.mock(instance.getClass(), settings); return (T) mock(instance.getClass(), settings);
} }
/** /**
......
...@@ -46,7 +46,7 @@ import org.springframework.web.server.ServerWebExchange; ...@@ -46,7 +46,7 @@ import org.springframework.web.server.ServerWebExchange;
* <li>errors - Any {@link ObjectError}s from a {@link BindingResult} exception * <li>errors - Any {@link ObjectError}s from a {@link BindingResult} exception
* <li>trace - The exception stack trace</li> * <li>trace - The exception stack trace</li>
* <li>path - The URL path when the exception was raised</li> * <li>path - The URL path when the exception was raised</li>
* <li>requestId - Unique Id associated with the current request</li> * <li>requestId - Unique ID associated with the current request</li>
* </ul> * </ul>
* *
* @author Brian Clozel * @author Brian Clozel
......
...@@ -19,7 +19,6 @@ package org.springframework.boot.context.properties; ...@@ -19,7 +19,6 @@ package org.springframework.boot.context.properties;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.springframework.boot.context.properties.scan.valid.a.AScanConfiguration; import org.springframework.boot.context.properties.scan.valid.a.AScanConfiguration;
import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext;
...@@ -29,6 +28,7 @@ import org.springframework.core.io.DefaultResourceLoader; ...@@ -29,6 +28,7 @@ import org.springframework.core.io.DefaultResourceLoader;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.willCallRealMethod; import static org.mockito.BDDMockito.willCallRealMethod;
import static org.mockito.Mockito.mock;
/** /**
* Integration tests for {@link ConfigurationPropertiesScan @ConfigurationPropertiesScan}. * Integration tests for {@link ConfigurationPropertiesScan @ConfigurationPropertiesScan}.
...@@ -71,7 +71,7 @@ class ConfigurationPropertiesScanTests { ...@@ -71,7 +71,7 @@ class ConfigurationPropertiesScanTests {
@Test @Test
void scanImportBeanRegistrarShouldBeResourceLoaderAwareWithRequiredResource() { void scanImportBeanRegistrarShouldBeResourceLoaderAwareWithRequiredResource() {
DefaultResourceLoader resourceLoader = Mockito.mock(DefaultResourceLoader.class); DefaultResourceLoader resourceLoader = mock(DefaultResourceLoader.class);
this.context.setResourceLoader(resourceLoader); this.context.setResourceLoader(resourceLoader);
willCallRealMethod().given(resourceLoader).getClassLoader(); willCallRealMethod().given(resourceLoader).getClassLoader();
given(resourceLoader.getResource("test")).willReturn(new ByteArrayResource("test".getBytes())); given(resourceLoader.getResource("test")).willReturn(new ByteArrayResource("test".getBytes()));
......
...@@ -26,7 +26,6 @@ import javax.xml.transform.sax.SAXTransformerFactory; ...@@ -26,7 +26,6 @@ import javax.xml.transform.sax.SAXTransformerFactory;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations; import org.mockito.MockitoAnnotations;
import org.springframework.http.client.ClientHttpRequestFactory; import org.springframework.http.client.ClientHttpRequestFactory;
...@@ -199,8 +198,8 @@ class WebServiceTemplateBuilderTests { ...@@ -199,8 +198,8 @@ class WebServiceTemplateBuilderTests {
@Test @Test
void additionalInterceptorsShouldAddToExistingWebServiceTemplate() { void additionalInterceptorsShouldAddToExistingWebServiceTemplate() {
ClientInterceptor f1 = Mockito.mock(ClientInterceptor.class); ClientInterceptor f1 = mock(ClientInterceptor.class);
ClientInterceptor f2 = Mockito.mock(ClientInterceptor.class); ClientInterceptor f2 = mock(ClientInterceptor.class);
WebServiceTemplate webServiceTemplate = new WebServiceTemplate(); WebServiceTemplate webServiceTemplate = new WebServiceTemplate();
webServiceTemplate.setInterceptors(new ClientInterceptor[] { f1 }); webServiceTemplate.setInterceptors(new ClientInterceptor[] { f1 });
this.builder.additionalInterceptors(f2).configure(webServiceTemplate); this.builder.additionalInterceptors(f2).configure(webServiceTemplate);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment