See gh-17413
This commit is contained in:
Johnny Lim 2019-07-03 10:10:01 +09:00 committed by Stephane Nicoll
parent 939a247d87
commit 426ef749db
10 changed files with 19 additions and 18 deletions

View File

@ -21,7 +21,6 @@ import org.apache.catalina.connector.Connector;
import org.apache.catalina.startup.Tomcat;
import org.eclipse.jetty.server.Server;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import reactor.netty.http.server.HttpServer;
import org.springframework.boot.autoconfigure.AutoConfigurations;
@ -275,7 +274,7 @@ class ReactiveWebServerFactoryAutoConfigurationTests {
@Bean
HttpHandler httpHandler() {
return Mockito.mock(HttpHandler.class);
return mock(HttpHandler.class);
}
}
@ -285,7 +284,7 @@ class ReactiveWebServerFactoryAutoConfigurationTests {
@Bean
HttpHandler additionalHttpHandler() {
return Mockito.mock(HttpHandler.class);
return mock(HttpHandler.class);
}
}

View File

@ -46,7 +46,7 @@ public final class DevToolsEnablementDeducer {
* Checks if a specific {@link StackTraceElement} in the current thread's stacktrace
* should cause devtools to be disabled.
* @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) {
for (StackTraceElement element : thread.getStackTrace()) {

View File

@ -1982,7 +1982,7 @@ following information:
|`status`
|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`
|Request's URI template prior to variable substitution, if possible (for example,

View File

@ -3560,12 +3560,12 @@ The following code shows a typical example:
public MyService(RSocketRequester.Builder rsocketRequesterBuilder) {
this.rsocketRequester = rsocketRequesterBuilder
.connectTcp("example.org", 9090).block();
.connectTcp("example.org", 9090).block();
}
public Mono<User> someRSocketCall(String name) {
return this.requester.route("user").data(payload)
.retrieveMono(User.class);
return this.requester.route("user").data(name)
.retrieveMono(User.class);
}
}

View File

@ -191,7 +191,7 @@ public class SpringBootTestContextBootstrapper extends DefaultTestContextBootstr
* Determines the resource base path for web applications using the value of
* {@link WebAppConfiguration @WebAppConfiguration}, if any, on the test class of the
* 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
* @since 2.1.6
*/

View File

@ -23,7 +23,6 @@ import java.util.Set;
import org.mockito.Answers;
import org.mockito.MockSettings;
import org.mockito.Mockito;
import org.springframework.core.ResolvableType;
import org.springframework.core.style.ToStringCreator;
@ -32,6 +31,8 @@ import org.springframework.util.ClassUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import static org.mockito.Mockito.mock;
/**
* A complete definition that can be used to create a Mockito mock.
*
@ -150,7 +151,7 @@ class MockDefinition extends Definition {
if (this.serializable) {
settings.serializable();
}
return (T) Mockito.mock(this.typeToMock.resolve(), settings);
return (T) mock(this.typeToMock.resolve(), settings);
}
}

View File

@ -28,6 +28,8 @@ import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import static org.mockito.Mockito.mock;
/**
* A complete definition that can be used to create a Mockito spy.
*
@ -98,7 +100,7 @@ class SpyDefinition extends Definition {
if (this.isProxyTargetAware()) {
settings.verificationStartedListeners(new SpringAopBypassingVerificationStartedListener());
}
return (T) Mockito.mock(instance.getClass(), settings);
return (T) mock(instance.getClass(), settings);
}
/**

View File

@ -46,7 +46,7 @@ import org.springframework.web.server.ServerWebExchange;
* <li>errors - Any {@link ObjectError}s from a {@link BindingResult} exception
* <li>trace - The exception stack trace</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>
*
* @author Brian Clozel

View File

@ -19,7 +19,6 @@ package org.springframework.boot.context.properties;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.springframework.boot.context.properties.scan.valid.a.AScanConfiguration;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
@ -29,6 +28,7 @@ import org.springframework.core.io.DefaultResourceLoader;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.willCallRealMethod;
import static org.mockito.Mockito.mock;
/**
* Integration tests for {@link ConfigurationPropertiesScan @ConfigurationPropertiesScan}.
@ -71,7 +71,7 @@ class ConfigurationPropertiesScanTests {
@Test
void scanImportBeanRegistrarShouldBeResourceLoaderAwareWithRequiredResource() {
DefaultResourceLoader resourceLoader = Mockito.mock(DefaultResourceLoader.class);
DefaultResourceLoader resourceLoader = mock(DefaultResourceLoader.class);
this.context.setResourceLoader(resourceLoader);
willCallRealMethod().given(resourceLoader).getClassLoader();
given(resourceLoader.getResource("test")).willReturn(new ByteArrayResource("test".getBytes()));

View File

@ -26,7 +26,6 @@ import javax.xml.transform.sax.SAXTransformerFactory;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.springframework.http.client.ClientHttpRequestFactory;
@ -199,8 +198,8 @@ class WebServiceTemplateBuilderTests {
@Test
void additionalInterceptorsShouldAddToExistingWebServiceTemplate() {
ClientInterceptor f1 = Mockito.mock(ClientInterceptor.class);
ClientInterceptor f2 = Mockito.mock(ClientInterceptor.class);
ClientInterceptor f1 = mock(ClientInterceptor.class);
ClientInterceptor f2 = mock(ClientInterceptor.class);
WebServiceTemplate webServiceTemplate = new WebServiceTemplate();
webServiceTemplate.setInterceptors(new ClientInterceptor[] { f1 });
this.builder.additionalInterceptors(f2).configure(webServiceTemplate);