Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
d3c817b7
Commit
d3c817b7
authored
May 17, 2021
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish "Remove unnecessary throws declaration in tests"
See gh-26441
parent
8a2be288
Changes
49
Hide whitespace changes
Inline
Side-by-side
Showing
49 changed files
with
106 additions
and
164 deletions
+106
-164
HeapDumpWebEndpointDocumentationTests.java
.../documentation/HeapDumpWebEndpointDocumentationTests.java
+2
-2
MeterRegistryConfigurerIntegrationTests.java
...gure/metrics/MeterRegistryConfigurerIntegrationTests.java
+2
-3
DataSourcePoolMetricsAutoConfigurationTests.java
...ics/jdbc/DataSourcePoolMetricsAutoConfigurationTests.java
+1
-2
ReactiveManagementWebSecurityAutoConfigurationTests.java
.../ReactiveManagementWebSecurityAutoConfigurationTests.java
+1
-2
MockReactiveWebServerFactory.java
...oconfigure/web/reactive/MockReactiveWebServerFactory.java
+3
-4
MockServletWebServerFactory.java
...utoconfigure/web/servlet/MockServletWebServerFactory.java
+2
-3
CachingOperationInvokerTests.java
.../endpoint/invoker/cache/CachingOperationInvokerTests.java
+2
-3
WebEndpointTestInvocationContextProvider.java
...nt/web/test/WebEndpointTestInvocationContextProvider.java
+3
-6
HeapDumpWebEndpointTests.java
...ork/boot/actuate/management/HeapDumpWebEndpointTests.java
+2
-2
AutoConfigurationImportSelectorTests.java
...t/autoconfigure/AutoConfigurationImportSelectorTests.java
+2
-3
SharedMetadataReaderFactoryContextInitializerTests.java
...e/SharedMetadataReaderFactoryContextInitializerTests.java
+3
-4
MockCachingProvider.java
...boot/autoconfigure/cache/support/MockCachingProvider.java
+2
-3
CassandraAutoConfigurationIntegrationTests.java
...cassandra/CassandraAutoConfigurationIntegrationTests.java
+1
-2
MessageSourceAutoConfigurationTests.java
...onfigure/context/MessageSourceAutoConfigurationTests.java
+3
-4
RedisAutoConfigurationJedisTests.java
...onfigure/data/redis/RedisAutoConfigurationJedisTests.java
+2
-3
H2ConsoleAutoConfigurationTests.java
...oot/autoconfigure/h2/H2ConsoleAutoConfigurationTests.java
+2
-3
DataSourceInitializationIntegrationTests.java
...figure/jdbc/DataSourceInitializationIntegrationTests.java
+1
-2
JndiDataSourceAutoConfigurationTests.java
...oconfigure/jdbc/JndiDataSourceAutoConfigurationTests.java
+4
-4
JmsAutoConfigurationTests.java
...ork/boot/autoconfigure/jms/JmsAutoConfigurationTests.java
+2
-3
MailSenderAutoConfigurationTests.java
.../autoconfigure/mail/MailSenderAutoConfigurationTests.java
+2
-2
ReactiveOAuth2ClientAutoConfigurationTests.java
.../reactive/ReactiveOAuth2ClientAutoConfigurationTests.java
+1
-2
MockReactiveWebServerFactory.java
...oconfigure/web/reactive/MockReactiveWebServerFactory.java
+3
-4
DispatcherServletAutoConfigurationTests.java
.../web/servlet/DispatcherServletAutoConfigurationTests.java
+2
-3
MockServletWebServerFactory.java
...utoconfigure/web/servlet/MockServletWebServerFactory.java
+2
-3
ServletWebServerFactoryAutoConfigurationTests.java
...ervlet/ServletWebServerFactoryAutoConfigurationTests.java
+2
-3
AbstractDevToolsDataSourceAutoConfigurationTests.java
...ure/AbstractDevToolsDataSourceAutoConfigurationTests.java
+3
-4
MockRestarter.java
.../springframework/boot/devtools/restart/MockRestarter.java
+3
-6
MockBeanOnContextHierarchyIntegrationTests.java
...k/mockito/MockBeanOnContextHierarchyIntegrationTests.java
+2
-3
MockitoPostProcessorTests.java
...ork/boot/test/mock/mockito/MockitoPostProcessorTests.java
+3
-4
SpyBeanOnContextHierarchyIntegrationTests.java
...ck/mockito/SpyBeanOnContextHierarchyIntegrationTests.java
+2
-3
NoTestRestTemplateBeanChecker.java
...k/boot/test/web/client/NoTestRestTemplateBeanChecker.java
+2
-3
TestRestTemplateContextCustomizerTests.java
...st/web/client/TestRestTemplateContextCustomizerTests.java
+3
-4
TestRestTemplateTests.java
...framework/boot/test/web/client/TestRestTemplateTests.java
+1
-1
NoWebTestClientBeanChecker.java
.../test/web/reactive/server/NoWebTestClientBeanChecker.java
+2
-3
BuildInfoIntegrationTests.java
...oot/gradle/tasks/buildinfo/BuildInfoIntegrationTests.java
+1
-4
AbstractBootArchiveIntegrationTests.java
...e/tasks/bundling/AbstractBootArchiveIntegrationTests.java
+4
-10
MavenBuildExtension.java
...a/org/springframework/boot/maven/MavenBuildExtension.java
+3
-6
SpringApplicationTests.java
...java/org/springframework/boot/SpringApplicationTests.java
+1
-2
ConfigDataEnvironmentPostProcessorImportCombinedWithProfileSpecificIntegrationTests.java
...sorImportCombinedWithProfileSpecificIntegrationTests.java
+3
-5
ConfigDataLocationResolversTests.java
...boot/context/config/ConfigDataLocationResolversTests.java
+2
-3
LoggingApplicationListenerTests.java
...boot/context/logging/LoggingApplicationListenerTests.java
+1
-1
ConfigurationPropertiesTests.java
...boot/context/properties/ConfigurationPropertiesTests.java
+2
-3
BindConverterTests.java
...work/boot/context/properties/bind/BindConverterTests.java
+2
-2
BinderTests.java
...ngframework/boot/context/properties/bind/BinderTests.java
+1
-1
FailureAnalyzersTests.java
...ringframework/boot/diagnostics/FailureAnalyzersTests.java
+2
-3
JavaLoggingSystemTests.java
...ngframework/boot/logging/java/JavaLoggingSystemTests.java
+2
-2
MockReactiveWebServerFactory.java
...oot/web/reactive/server/MockReactiveWebServerFactory.java
+3
-4
MockServletWebServerFactory.java
.../boot/web/servlet/server/MockServletWebServerFactory.java
+2
-3
EmbeddedServerContainerInvocationContextProvider.java
...ded/EmbeddedServerContainerInvocationContextProvider.java
+4
-9
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/HeapDumpWebEndpointDocumentationTests.java
View file @
d3c817b7
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
21
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -65,7 +65,7 @@ class HeapDumpWebEndpointDocumentationTests extends MockMvcEndpointDocumentation
...
@@ -65,7 +65,7 @@ class HeapDumpWebEndpointDocumentationTests extends MockMvcEndpointDocumentation
return
new
HeapDumpWebEndpoint
()
{
return
new
HeapDumpWebEndpoint
()
{
@Override
@Override
protected
HeapDumper
createHeapDumper
()
throws
HeapDumperUnavailableException
{
protected
HeapDumper
createHeapDumper
()
{
return
(
file
,
live
)
->
FileCopyUtils
.
copy
(
"<<binary content>>"
,
new
FileWriter
(
file
));
return
(
file
,
live
)
->
FileCopyUtils
.
copy
(
"<<binary content>>"
,
new
FileWriter
(
file
));
}
}
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryConfigurerIntegrationTests.java
View file @
d3c817b7
/*
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -26,7 +26,6 @@ import io.micrometer.core.instrument.composite.CompositeMeterRegistry;
...
@@ -26,7 +26,6 @@ import io.micrometer.core.instrument.composite.CompositeMeterRegistry;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.slf4j.impl.StaticLoggerBinder
;
import
org.slf4j.impl.StaticLoggerBinder
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.boot.actuate.autoconfigure.metrics.export.atlas.AtlasMetricsExportAutoConfiguration
;
import
org.springframework.boot.actuate.autoconfigure.metrics.export.atlas.AtlasMetricsExportAutoConfiguration
;
import
org.springframework.boot.actuate.autoconfigure.metrics.export.jmx.JmxMetricsExportAutoConfiguration
;
import
org.springframework.boot.actuate.autoconfigure.metrics.export.jmx.JmxMetricsExportAutoConfiguration
;
...
@@ -134,7 +133,7 @@ class MeterRegistryConfigurerIntegrationTests {
...
@@ -134,7 +133,7 @@ class MeterRegistryConfigurerIntegrationTests {
return
new
BeanPostProcessor
()
{
return
new
BeanPostProcessor
()
{
@Override
@Override
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
{
if
(
bean
instanceof
Bravo
)
{
if
(
bean
instanceof
Bravo
)
{
MeterRegistry
meterRegistry
=
context
.
getBean
(
MeterRegistry
.
class
);
MeterRegistry
meterRegistry
=
context
.
getBean
(
MeterRegistry
.
class
);
meterRegistry
.
gauge
(
"test"
,
1
);
meterRegistry
.
gauge
(
"test"
,
1
);
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/jdbc/DataSourcePoolMetricsAutoConfigurationTests.java
View file @
d3c817b7
...
@@ -28,7 +28,6 @@ import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
...
@@ -28,7 +28,6 @@ import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.aop.framework.ProxyFactory
;
import
org.springframework.aop.framework.ProxyFactory
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun
;
import
org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
...
@@ -312,7 +311,7 @@ class DataSourcePoolMetricsAutoConfigurationTests {
...
@@ -312,7 +311,7 @@ class DataSourcePoolMetricsAutoConfigurationTests {
}
}
@Override
@Override
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
{
if
(
bean
instanceof
HikariDataSource
)
{
if
(
bean
instanceof
HikariDataSource
)
{
try
{
try
{
((
HikariDataSource
)
bean
).
getConnection
().
close
();
((
HikariDataSource
)
bean
).
getConnection
().
close
();
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/reactive/ReactiveManagementWebSecurityAutoConfigurationTests.java
View file @
d3c817b7
...
@@ -24,7 +24,6 @@ import java.util.List;
...
@@ -24,7 +24,6 @@ import java.util.List;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
reactor.core.publisher.Mono
;
import
reactor.core.publisher.Mono
;
import
org.springframework.beans.BeansException
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration
;
import
org.springframework.boot.actuate.autoconfigure.env.EnvironmentEndpointAutoConfiguration
;
import
org.springframework.boot.actuate.autoconfigure.env.EnvironmentEndpointAutoConfiguration
;
...
@@ -199,7 +198,7 @@ class ReactiveManagementWebSecurityAutoConfigurationTests {
...
@@ -199,7 +198,7 @@ class ReactiveManagementWebSecurityAutoConfigurationTests {
static
class
TestServerHttpSecurity
extends
ServerHttpSecurity
implements
ApplicationContextAware
{
static
class
TestServerHttpSecurity
extends
ServerHttpSecurity
implements
ApplicationContextAware
{
@Override
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
{
super
.
setApplicationContext
(
applicationContext
);
super
.
setApplicationContext
(
applicationContext
);
}
}
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/reactive/MockReactiveWebServerFactory.java
View file @
d3c817b7
/*
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -21,7 +21,6 @@ import java.util.Map;
...
@@ -21,7 +21,6 @@ import java.util.Map;
import
org.springframework.boot.web.reactive.server.AbstractReactiveWebServerFactory
;
import
org.springframework.boot.web.reactive.server.AbstractReactiveWebServerFactory
;
import
org.springframework.boot.web.reactive.server.ReactiveWebServerFactory
;
import
org.springframework.boot.web.reactive.server.ReactiveWebServerFactory
;
import
org.springframework.boot.web.server.WebServer
;
import
org.springframework.boot.web.server.WebServer
;
import
org.springframework.boot.web.server.WebServerException
;
import
org.springframework.http.server.reactive.HttpHandler
;
import
org.springframework.http.server.reactive.HttpHandler
;
import
static
org
.
mockito
.
Mockito
.
spy
;
import
static
org
.
mockito
.
Mockito
.
spy
;
...
@@ -72,12 +71,12 @@ class MockReactiveWebServerFactory extends AbstractReactiveWebServerFactory {
...
@@ -72,12 +71,12 @@ class MockReactiveWebServerFactory extends AbstractReactiveWebServerFactory {
}
}
@Override
@Override
public
void
start
()
throws
WebServerException
{
public
void
start
()
{
}
}
@Override
@Override
public
void
stop
()
throws
WebServerException
{
public
void
stop
()
{
}
}
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/MockServletWebServerFactory.java
View file @
d3c817b7
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
21
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -23,7 +23,6 @@ import javax.servlet.ServletContext;
...
@@ -23,7 +23,6 @@ import javax.servlet.ServletContext;
import
org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredFilter
;
import
org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredFilter
;
import
org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredServlet
;
import
org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredServlet
;
import
org.springframework.boot.web.server.WebServer
;
import
org.springframework.boot.web.server.WebServer
;
import
org.springframework.boot.web.server.WebServerException
;
import
org.springframework.boot.web.servlet.ServletContextInitializer
;
import
org.springframework.boot.web.servlet.ServletContextInitializer
;
import
org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory
;
import
org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory
;
import
org.springframework.boot.web.servlet.server.ServletWebServerFactory
;
import
org.springframework.boot.web.servlet.server.ServletWebServerFactory
;
...
@@ -71,7 +70,7 @@ public class MockServletWebServerFactory extends AbstractServletWebServerFactory
...
@@ -71,7 +70,7 @@ public class MockServletWebServerFactory extends AbstractServletWebServerFactory
}
}
@Override
@Override
public
void
start
()
throws
WebServerException
{
public
void
start
()
{
}
}
}
}
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/invoker/cache/CachingOperationInvokerTests.java
View file @
d3c817b7
...
@@ -31,7 +31,6 @@ import org.springframework.boot.actuate.endpoint.ApiVersion;
...
@@ -31,7 +31,6 @@ import org.springframework.boot.actuate.endpoint.ApiVersion;
import
org.springframework.boot.actuate.endpoint.InvocationContext
;
import
org.springframework.boot.actuate.endpoint.InvocationContext
;
import
org.springframework.boot.actuate.endpoint.OperationArgumentResolver
;
import
org.springframework.boot.actuate.endpoint.OperationArgumentResolver
;
import
org.springframework.boot.actuate.endpoint.SecurityContext
;
import
org.springframework.boot.actuate.endpoint.SecurityContext
;
import
org.springframework.boot.actuate.endpoint.invoke.MissingParametersException
;
import
org.springframework.boot.actuate.endpoint.invoke.OperationInvoker
;
import
org.springframework.boot.actuate.endpoint.invoke.OperationInvoker
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
@@ -221,7 +220,7 @@ class CachingOperationInvokerTests {
...
@@ -221,7 +220,7 @@ class CachingOperationInvokerTests {
static
AtomicInteger
invocations
=
new
AtomicInteger
();
static
AtomicInteger
invocations
=
new
AtomicInteger
();
@Override
@Override
public
Mono
<
String
>
invoke
(
InvocationContext
context
)
throws
MissingParametersException
{
public
Mono
<
String
>
invoke
(
InvocationContext
context
)
{
return
Mono
.
fromCallable
(()
->
{
return
Mono
.
fromCallable
(()
->
{
invocations
.
incrementAndGet
();
invocations
.
incrementAndGet
();
return
"test"
;
return
"test"
;
...
@@ -235,7 +234,7 @@ class CachingOperationInvokerTests {
...
@@ -235,7 +234,7 @@ class CachingOperationInvokerTests {
static
AtomicInteger
invocations
=
new
AtomicInteger
();
static
AtomicInteger
invocations
=
new
AtomicInteger
();
@Override
@Override
public
Flux
<
String
>
invoke
(
InvocationContext
context
)
throws
MissingParametersException
{
public
Flux
<
String
>
invoke
(
InvocationContext
context
)
{
return
Flux
.
just
(
"spring"
,
"boot"
).
hide
().
doFirst
(
invocations:
:
incrementAndGet
);
return
Flux
.
just
(
"spring"
,
"boot"
).
hide
().
doFirst
(
invocations:
:
incrementAndGet
);
}
}
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/test/WebEndpointTestInvocationContextProvider.java
View file @
d3c817b7
/*
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -32,7 +32,6 @@ import org.junit.jupiter.api.extension.BeforeEachCallback;
...
@@ -32,7 +32,6 @@ import org.junit.jupiter.api.extension.BeforeEachCallback;
import
org.junit.jupiter.api.extension.Extension
;
import
org.junit.jupiter.api.extension.Extension
;
import
org.junit.jupiter.api.extension.ExtensionContext
;
import
org.junit.jupiter.api.extension.ExtensionContext
;
import
org.junit.jupiter.api.extension.ParameterContext
;
import
org.junit.jupiter.api.extension.ParameterContext
;
import
org.junit.jupiter.api.extension.ParameterResolutionException
;
import
org.junit.jupiter.api.extension.ParameterResolver
;
import
org.junit.jupiter.api.extension.ParameterResolver
;
import
org.junit.jupiter.api.extension.TestTemplateInvocationContext
;
import
org.junit.jupiter.api.extension.TestTemplateInvocationContext
;
import
org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider
;
import
org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider
;
...
@@ -161,15 +160,13 @@ class WebEndpointTestInvocationContextProvider implements TestTemplateInvocation
...
@@ -161,15 +160,13 @@ class WebEndpointTestInvocationContextProvider implements TestTemplateInvocation
}
}
@Override
@Override
public
boolean
supportsParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
public
boolean
supportsParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
{
throws
ParameterResolutionException
{
Class
<?>
type
=
parameterContext
.
getParameter
().
getType
();
Class
<?>
type
=
parameterContext
.
getParameter
().
getType
();
return
type
.
equals
(
WebTestClient
.
class
)
||
type
.
isAssignableFrom
(
ConfigurableApplicationContext
.
class
);
return
type
.
equals
(
WebTestClient
.
class
)
||
type
.
isAssignableFrom
(
ConfigurableApplicationContext
.
class
);
}
}
@Override
@Override
public
Object
resolveParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
public
Object
resolveParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
{
throws
ParameterResolutionException
{
Class
<?>
type
=
parameterContext
.
getParameter
().
getType
();
Class
<?>
type
=
parameterContext
.
getParameter
().
getType
();
if
(
type
.
equals
(
WebTestClient
.
class
))
{
if
(
type
.
equals
(
WebTestClient
.
class
))
{
return
createWebTestClient
();
return
createWebTestClient
();
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/management/HeapDumpWebEndpointTests.java
View file @
d3c817b7
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
21
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -36,7 +36,7 @@ class HeapDumpWebEndpointTests {
...
@@ -36,7 +36,7 @@ class HeapDumpWebEndpointTests {
HeapDumpWebEndpoint
slowEndpoint
=
new
HeapDumpWebEndpoint
(
2500
)
{
HeapDumpWebEndpoint
slowEndpoint
=
new
HeapDumpWebEndpoint
(
2500
)
{
@Override
@Override
protected
HeapDumper
createHeapDumper
()
throws
HeapDumperUnavailableException
{
protected
HeapDumper
createHeapDumper
()
{
return
(
file
,
live
)
->
{
return
(
file
,
live
)
->
{
dumpingLatch
.
countDown
();
dumpingLatch
.
countDown
();
blockingLatch
.
await
();
blockingLatch
.
await
();
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelectorTests.java
View file @
d3c817b7
/*
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -25,7 +25,6 @@ import java.util.Set;
...
@@ -25,7 +25,6 @@ import java.util.Set;
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.springframework.beans.BeansException
;
import
org.springframework.beans.factory.BeanFactory
;
import
org.springframework.beans.factory.BeanFactory
;
import
org.springframework.beans.factory.BeanFactoryAware
;
import
org.springframework.beans.factory.BeanFactoryAware
;
import
org.springframework.beans.factory.config.ConfigurableListableBeanFactory
;
import
org.springframework.beans.factory.config.ConfigurableListableBeanFactory
;
...
@@ -260,7 +259,7 @@ class AutoConfigurationImportSelectorTests {
...
@@ -260,7 +259,7 @@ class AutoConfigurationImportSelectorTests {
}
}
@Override
@Override
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
throws
BeansException
{
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
{
this
.
beanFactory
=
beanFactory
;
this
.
beanFactory
=
beanFactory
;
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/SharedMetadataReaderFactoryContextInitializerTests.java
View file @
d3c817b7
/*
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -21,7 +21,6 @@ import java.util.List;
...
@@ -21,7 +21,6 @@ import java.util.List;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.mockito.ArgumentCaptor
;
import
org.mockito.ArgumentCaptor
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.config.BeanDefinition
;
import
org.springframework.beans.factory.config.BeanDefinition
;
import
org.springframework.beans.factory.config.ConfigurableListableBeanFactory
;
import
org.springframework.beans.factory.config.ConfigurableListableBeanFactory
;
import
org.springframework.beans.factory.support.AbstractBeanDefinition
;
import
org.springframework.beans.factory.support.AbstractBeanDefinition
;
...
@@ -106,11 +105,11 @@ class SharedMetadataReaderFactoryContextInitializerTests {
...
@@ -106,11 +105,11 @@ class SharedMetadataReaderFactoryContextInitializerTests {
static
class
PostProcessor
implements
BeanDefinitionRegistryPostProcessor
{
static
class
PostProcessor
implements
BeanDefinitionRegistryPostProcessor
{
@Override
@Override
public
void
postProcessBeanFactory
(
ConfigurableListableBeanFactory
beanFactory
)
throws
BeansException
{
public
void
postProcessBeanFactory
(
ConfigurableListableBeanFactory
beanFactory
)
{
}
}
@Override
@Override
public
void
postProcessBeanDefinitionRegistry
(
BeanDefinitionRegistry
registry
)
throws
BeansException
{
public
void
postProcessBeanDefinitionRegistry
(
BeanDefinitionRegistry
registry
)
{
for
(
String
name
:
registry
.
getBeanDefinitionNames
())
{
for
(
String
name
:
registry
.
getBeanDefinitionNames
())
{
BeanDefinition
definition
=
registry
.
getBeanDefinition
(
name
);
BeanDefinition
definition
=
registry
.
getBeanDefinition
(
name
);
definition
.
setAttribute
(
"seen"
,
true
);
definition
.
setAttribute
(
"seen"
,
true
);
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/support/MockCachingProvider.java
View file @
d3c817b7
/*
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -127,8 +127,7 @@ public class MockCachingProvider implements CachingProvider {
...
@@ -127,8 +127,7 @@ public class MockCachingProvider implements CachingProvider {
@Override
@Override
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
public
<
K
,
V
,
C
extends
Configuration
<
K
,
V
>>
Cache
<
K
,
V
>
createCache
(
String
cacheName
,
C
configuration
)
public
<
K
,
V
,
C
extends
Configuration
<
K
,
V
>>
Cache
<
K
,
V
>
createCache
(
String
cacheName
,
C
configuration
)
{
throws
IllegalArgumentException
{
this
.
configurations
.
put
(
cacheName
,
configuration
);
this
.
configurations
.
put
(
cacheName
,
configuration
);
Cache
<
K
,
V
>
cache
=
mock
(
Cache
.
class
);
Cache
<
K
,
V
>
cache
=
mock
(
Cache
.
class
);
given
(
cache
.
getName
()).
willReturn
(
cacheName
);
given
(
cache
.
getName
()).
willReturn
(
cacheName
);
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cassandra/CassandraAutoConfigurationIntegrationTests.java
View file @
d3c817b7
...
@@ -25,7 +25,6 @@ import org.testcontainers.containers.CassandraContainer;
...
@@ -25,7 +25,6 @@ import org.testcontainers.containers.CassandraContainer;
import
org.testcontainers.junit.jupiter.Container
;
import
org.testcontainers.junit.jupiter.Container
;
import
org.testcontainers.junit.jupiter.Testcontainers
;
import
org.testcontainers.junit.jupiter.Testcontainers
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.beans.factory.support.BeanDefinitionRegistry
;
import
org.springframework.beans.factory.support.BeanDefinitionRegistry
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
...
@@ -78,7 +77,7 @@ class CassandraAutoConfigurationIntegrationTests {
...
@@ -78,7 +77,7 @@ class CassandraAutoConfigurationIntegrationTests {
return
new
BeanPostProcessor
()
{
return
new
BeanPostProcessor
()
{
@Override
@Override
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
{
if
(
bean
instanceof
DriverConfigLoader
)
{
if
(
bean
instanceof
DriverConfigLoader
)
{
return
spy
(
bean
);
return
spy
(
bean
);
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationTests.java
View file @
d3c817b7
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
21
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -27,7 +27,6 @@ import org.springframework.boot.test.context.runner.ApplicationContextRunner;
...
@@ -27,7 +27,6 @@ import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import
org.springframework.boot.test.context.runner.ContextConsumer
;
import
org.springframework.boot.test.context.runner.ContextConsumer
;
import
org.springframework.context.MessageSource
;
import
org.springframework.context.MessageSource
;
import
org.springframework.context.MessageSourceResolvable
;
import
org.springframework.context.MessageSourceResolvable
;
import
org.springframework.context.NoSuchMessageException
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.PropertySource
;
import
org.springframework.context.annotation.PropertySource
;
...
@@ -223,12 +222,12 @@ class MessageSourceAutoConfigurationTests {
...
@@ -223,12 +222,12 @@ class MessageSourceAutoConfigurationTests {
}
}
@Override
@Override
public
String
getMessage
(
String
code
,
Object
[]
args
,
Locale
locale
)
throws
NoSuchMessageException
{
public
String
getMessage
(
String
code
,
Object
[]
args
,
Locale
locale
)
{
return
code
;
return
code
;
}
}
@Override
@Override
public
String
getMessage
(
MessageSourceResolvable
resolvable
,
Locale
locale
)
throws
NoSuchMessageException
{
public
String
getMessage
(
MessageSourceResolvable
resolvable
,
Locale
locale
)
{
return
resolvable
.
getCodes
()[
0
];
return
resolvable
.
getCodes
()[
0
];
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationJedisTests.java
View file @
d3c817b7
/*
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -18,7 +18,6 @@ package org.springframework.boot.autoconfigure.data.redis;
...
@@ -18,7 +18,6 @@ package org.springframework.boot.autoconfigure.data.redis;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
import
org.springframework.boot.test.context.runner.ApplicationContextRunner
;
import
org.springframework.boot.test.context.runner.ApplicationContextRunner
;
...
@@ -233,7 +232,7 @@ class RedisAutoConfigurationJedisTests {
...
@@ -233,7 +232,7 @@ class RedisAutoConfigurationJedisTests {
static
JedisConnectionFactory
connectionFactory
;
static
JedisConnectionFactory
connectionFactory
;
@Override
@Override
public
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
public
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
{
if
(
bean
instanceof
JedisConnectionFactory
)
{
if
(
bean
instanceof
JedisConnectionFactory
)
{
connectionFactory
=
(
JedisConnectionFactory
)
bean
;
connectionFactory
=
(
JedisConnectionFactory
)
bean
;
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/h2/H2ConsoleAutoConfigurationTests.java
View file @
d3c817b7
/*
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -24,7 +24,6 @@ import javax.sql.DataSource;
...
@@ -24,7 +24,6 @@ import javax.sql.DataSource;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
import
org.junit.jupiter.api.extension.ExtendWith
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.BeanCreationException
;
import
org.springframework.beans.factory.BeanCreationException
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
import
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
;
import
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
;
...
@@ -115,7 +114,7 @@ class H2ConsoleAutoConfigurationTests {
...
@@ -115,7 +114,7 @@ class H2ConsoleAutoConfigurationTests {
@Test
@Test
@ExtendWith
(
OutputCaptureExtension
.
class
)
@ExtendWith
(
OutputCaptureExtension
.
class
)
void
dataSourceUrlIsLoggedWhenAvailable
(
CapturedOutput
output
)
throws
BeansException
{
void
dataSourceUrlIsLoggedWhenAvailable
(
CapturedOutput
output
)
{
this
.
contextRunner
.
withConfiguration
(
AutoConfigurations
.
of
(
DataSourceAutoConfiguration
.
class
))
this
.
contextRunner
.
withConfiguration
(
AutoConfigurations
.
of
(
DataSourceAutoConfiguration
.
class
))
.
withPropertyValues
(
"spring.h2.console.enabled=true"
).
run
((
context
)
->
{
.
withPropertyValues
(
"spring.h2.console.enabled=true"
).
run
((
context
)
->
{
try
(
Connection
connection
=
context
.
getBean
(
DataSource
.
class
).
getConnection
())
{
try
(
Connection
connection
=
context
.
getBean
(
DataSource
.
class
).
getConnection
())
{
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializationIntegrationTests.java
View file @
d3c817b7
...
@@ -33,7 +33,6 @@ import javax.sql.DataSource;
...
@@ -33,7 +33,6 @@ import javax.sql.DataSource;
import
com.zaxxer.hikari.HikariDataSource
;
import
com.zaxxer.hikari.HikariDataSource
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.BeanCreationException
;
import
org.springframework.beans.factory.BeanCreationException
;
import
org.springframework.beans.factory.config.BeanFactoryPostProcessor
;
import
org.springframework.beans.factory.config.BeanFactoryPostProcessor
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
...
@@ -348,7 +347,7 @@ class DataSourceInitializationIntegrationTests {
...
@@ -348,7 +347,7 @@ class DataSourceInitializationIntegrationTests {
return
new
BeanPostProcessor
()
{
return
new
BeanPostProcessor
()
{
@Override
@Override
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
{
if
(
bean
instanceof
DataSource
)
{
if
(
bean
instanceof
DataSource
)
{
return
new
DataSourceProxy
((
DataSource
)
bean
);
return
new
DataSourceProxy
((
DataSource
)
bean
);
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfigurationTests.java
View file @
d3c817b7
...
@@ -93,7 +93,7 @@ class JndiDataSourceAutoConfigurationTests {
...
@@ -93,7 +93,7 @@ class JndiDataSourceAutoConfigurationTests {
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
@Test
@Test
void
mbeanDataSourceIsExcludedFromExport
()
throws
IllegalStateException
{
void
mbeanDataSourceIsExcludedFromExport
()
{
DataSource
dataSource
=
new
BasicDataSource
();
DataSource
dataSource
=
new
BasicDataSource
();
configureJndi
(
"foo"
,
dataSource
);
configureJndi
(
"foo"
,
dataSource
);
...
@@ -110,7 +110,7 @@ class JndiDataSourceAutoConfigurationTests {
...
@@ -110,7 +110,7 @@ class JndiDataSourceAutoConfigurationTests {
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
@Test
@Test
void
mbeanDataSourceIsExcludedFromExportByAllExporters
()
throws
IllegalStateException
{
void
mbeanDataSourceIsExcludedFromExportByAllExporters
()
{
DataSource
dataSource
=
new
BasicDataSource
();
DataSource
dataSource
=
new
BasicDataSource
();
configureJndi
(
"foo"
,
dataSource
);
configureJndi
(
"foo"
,
dataSource
);
this
.
context
=
new
AnnotationConfigApplicationContext
();
this
.
context
=
new
AnnotationConfigApplicationContext
();
...
@@ -127,7 +127,7 @@ class JndiDataSourceAutoConfigurationTests {
...
@@ -127,7 +127,7 @@ class JndiDataSourceAutoConfigurationTests {
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
@Test
@Test
void
standardDataSourceIsNotExcludedFromExport
()
throws
IllegalStateException
{
void
standardDataSourceIsNotExcludedFromExport
()
{
DataSource
dataSource
=
mock
(
DataSource
.
class
);
DataSource
dataSource
=
mock
(
DataSource
.
class
);
configureJndi
(
"foo"
,
dataSource
);
configureJndi
(
"foo"
,
dataSource
);
...
@@ -142,7 +142,7 @@ class JndiDataSourceAutoConfigurationTests {
...
@@ -142,7 +142,7 @@ class JndiDataSourceAutoConfigurationTests {
assertThat
(
excludedBeans
).
isEmpty
();
assertThat
(
excludedBeans
).
isEmpty
();
}
}
private
void
configureJndi
(
String
name
,
DataSource
dataSource
)
throws
IllegalStateException
{
private
void
configureJndi
(
String
name
,
DataSource
dataSource
)
{
TestableInitialContextFactory
.
bind
(
name
,
dataSource
);
TestableInitialContextFactory
.
bind
(
name
,
dataSource
);
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfigurationTests.java
View file @
d3c817b7
...
@@ -24,7 +24,6 @@ import org.apache.activemq.ActiveMQConnectionFactory;
...
@@ -24,7 +24,6 @@ import org.apache.activemq.ActiveMQConnectionFactory;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.messaginghub.pooled.jms.JmsPoolConnectionFactory
;
import
org.messaginghub.pooled.jms.JmsPoolConnectionFactory
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
import
org.springframework.boot.autoconfigure.jms.activemq.ActiveMQAutoConfiguration
;
import
org.springframework.boot.autoconfigure.jms.activemq.ActiveMQAutoConfiguration
;
...
@@ -440,7 +439,7 @@ class JmsAutoConfigurationTests {
...
@@ -440,7 +439,7 @@ class JmsAutoConfigurationTests {
static
class
TestConfiguration4
implements
BeanPostProcessor
{
static
class
TestConfiguration4
implements
BeanPostProcessor
{
@Override
@Override
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
{
if
(
bean
.
getClass
().
isAssignableFrom
(
JmsTemplate
.
class
))
{
if
(
bean
.
getClass
().
isAssignableFrom
(
JmsTemplate
.
class
))
{
JmsTemplate
jmsTemplate
=
(
JmsTemplate
)
bean
;
JmsTemplate
jmsTemplate
=
(
JmsTemplate
)
bean
;
jmsTemplate
.
setPubSubDomain
(
true
);
jmsTemplate
.
setPubSubDomain
(
true
);
...
@@ -449,7 +448,7 @@ class JmsAutoConfigurationTests {
...
@@ -449,7 +448,7 @@ class JmsAutoConfigurationTests {
}
}
@Override
@Override
public
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
public
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
{
return
bean
;
return
bean
;
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mail/MailSenderAutoConfigurationTests.java
View file @
d3c817b7
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
21
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -238,7 +238,7 @@ class MailSenderAutoConfigurationTests {
...
@@ -238,7 +238,7 @@ class MailSenderAutoConfigurationTests {
});
});
}
}
private
Session
configureJndiSession
(
String
name
)
throws
IllegalStateException
{
private
Session
configureJndiSession
(
String
name
)
{
Properties
properties
=
new
Properties
();
Properties
properties
=
new
Properties
();
Session
session
=
Session
.
getDefaultInstance
(
properties
);
Session
session
=
Session
.
getDefaultInstance
(
properties
);
TestableInitialContextFactory
.
bind
(
name
,
session
);
TestableInitialContextFactory
.
bind
(
name
,
session
);
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/reactive/ReactiveOAuth2ClientAutoConfigurationTests.java
View file @
d3c817b7
...
@@ -23,7 +23,6 @@ import java.util.List;
...
@@ -23,7 +23,6 @@ import java.util.List;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Flux
;
import
org.springframework.beans.BeansException
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
import
org.springframework.boot.autoconfigure.security.reactive.ReactiveSecurityAutoConfiguration
;
import
org.springframework.boot.autoconfigure.security.reactive.ReactiveSecurityAutoConfiguration
;
import
org.springframework.boot.test.context.FilteredClassLoader
;
import
org.springframework.boot.test.context.FilteredClassLoader
;
...
@@ -253,7 +252,7 @@ class ReactiveOAuth2ClientAutoConfigurationTests {
...
@@ -253,7 +252,7 @@ class ReactiveOAuth2ClientAutoConfigurationTests {
static
class
TestServerHttpSecurity
extends
ServerHttpSecurity
implements
ApplicationContextAware
{
static
class
TestServerHttpSecurity
extends
ServerHttpSecurity
implements
ApplicationContextAware
{
@Override
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
{
super
.
setApplicationContext
(
applicationContext
);
super
.
setApplicationContext
(
applicationContext
);
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/MockReactiveWebServerFactory.java
View file @
d3c817b7
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
21
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -21,7 +21,6 @@ import java.util.Map;
...
@@ -21,7 +21,6 @@ import java.util.Map;
import
org.springframework.boot.web.reactive.server.AbstractReactiveWebServerFactory
;
import
org.springframework.boot.web.reactive.server.AbstractReactiveWebServerFactory
;
import
org.springframework.boot.web.reactive.server.ReactiveWebServerFactory
;
import
org.springframework.boot.web.reactive.server.ReactiveWebServerFactory
;
import
org.springframework.boot.web.server.WebServer
;
import
org.springframework.boot.web.server.WebServer
;
import
org.springframework.boot.web.server.WebServerException
;
import
org.springframework.http.server.reactive.HttpHandler
;
import
org.springframework.http.server.reactive.HttpHandler
;
import
static
org
.
mockito
.
Mockito
.
spy
;
import
static
org
.
mockito
.
Mockito
.
spy
;
...
@@ -72,12 +71,12 @@ public class MockReactiveWebServerFactory extends AbstractReactiveWebServerFacto
...
@@ -72,12 +71,12 @@ public class MockReactiveWebServerFactory extends AbstractReactiveWebServerFacto
}
}
@Override
@Override
public
void
start
()
throws
WebServerException
{
public
void
start
()
{
}
}
@Override
@Override
public
void
stop
()
throws
WebServerException
{
public
void
stop
()
{
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfigurationTests.java
View file @
d3c817b7
/*
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -29,7 +29,6 @@ import org.springframework.context.annotation.Bean;
...
@@ -29,7 +29,6 @@ import org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.event.ContextRefreshedEvent
;
import
org.springframework.context.event.ContextRefreshedEvent
;
import
org.springframework.util.unit.DataSize
;
import
org.springframework.util.unit.DataSize
;
import
org.springframework.web.multipart.MultipartException
;
import
org.springframework.web.multipart.MultipartHttpServletRequest
;
import
org.springframework.web.multipart.MultipartHttpServletRequest
;
import
org.springframework.web.multipart.MultipartResolver
;
import
org.springframework.web.multipart.MultipartResolver
;
import
org.springframework.web.servlet.DispatcherServlet
;
import
org.springframework.web.servlet.DispatcherServlet
;
...
@@ -273,7 +272,7 @@ class DispatcherServletAutoConfigurationTests {
...
@@ -273,7 +272,7 @@ class DispatcherServletAutoConfigurationTests {
}
}
@Override
@Override
public
MultipartHttpServletRequest
resolveMultipart
(
HttpServletRequest
request
)
throws
MultipartException
{
public
MultipartHttpServletRequest
resolveMultipart
(
HttpServletRequest
request
)
{
return
null
;
return
null
;
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/MockServletWebServerFactory.java
View file @
d3c817b7
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
21
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -23,7 +23,6 @@ import javax.servlet.ServletContext;
...
@@ -23,7 +23,6 @@ import javax.servlet.ServletContext;
import
org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredFilter
;
import
org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredFilter
;
import
org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredServlet
;
import
org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredServlet
;
import
org.springframework.boot.web.server.WebServer
;
import
org.springframework.boot.web.server.WebServer
;
import
org.springframework.boot.web.server.WebServerException
;
import
org.springframework.boot.web.servlet.ServletContextInitializer
;
import
org.springframework.boot.web.servlet.ServletContextInitializer
;
import
org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory
;
import
org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory
;
import
org.springframework.boot.web.servlet.server.ServletWebServerFactory
;
import
org.springframework.boot.web.servlet.server.ServletWebServerFactory
;
...
@@ -71,7 +70,7 @@ public class MockServletWebServerFactory extends AbstractServletWebServerFactory
...
@@ -71,7 +70,7 @@ public class MockServletWebServerFactory extends AbstractServletWebServerFactory
}
}
@Override
@Override
public
void
start
()
throws
WebServerException
{
public
void
start
()
{
}
}
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryAutoConfigurationTests.java
View file @
d3c817b7
/*
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -31,7 +31,6 @@ import org.eclipse.jetty.server.Server;
...
@@ -31,7 +31,6 @@ import org.eclipse.jetty.server.Server;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
reactor.netty.http.server.HttpServer
;
import
reactor.netty.http.server.HttpServer
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
;
...
@@ -455,7 +454,7 @@ class ServletWebServerFactoryAutoConfigurationTests {
...
@@ -455,7 +454,7 @@ class ServletWebServerFactoryAutoConfigurationTests {
static
class
EnsureWebServerHasNoServletContext
implements
BeanPostProcessor
{
static
class
EnsureWebServerHasNoServletContext
implements
BeanPostProcessor
{
@Override
@Override
public
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
public
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
{
if
(
bean
instanceof
ConfigurableServletWebServerFactory
)
{
if
(
bean
instanceof
ConfigurableServletWebServerFactory
)
{
MockServletWebServerFactory
webServerFactory
=
(
MockServletWebServerFactory
)
bean
;
MockServletWebServerFactory
webServerFactory
=
(
MockServletWebServerFactory
)
bean
;
assertThat
(
webServerFactory
.
getServletContext
()).
isNull
();
assertThat
(
webServerFactory
.
getServletContext
()).
isNull
();
...
...
spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/AbstractDevToolsDataSourceAutoConfigurationTests.java
View file @
d3c817b7
/*
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -27,7 +27,6 @@ import javax.sql.DataSource;
...
@@ -27,7 +27,6 @@ import javax.sql.DataSource;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.annotation.AnnotatedGenericBeanDefinition
;
import
org.springframework.beans.factory.annotation.AnnotatedGenericBeanDefinition
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.boot.test.util.TestPropertyValues
;
import
org.springframework.boot.test.util.TestPropertyValues
;
...
@@ -161,7 +160,7 @@ abstract class AbstractDevToolsDataSourceAutoConfigurationTests {
...
@@ -161,7 +160,7 @@ abstract class AbstractDevToolsDataSourceAutoConfigurationTests {
static
class
DataSourceSpyBeanPostProcessor
implements
BeanPostProcessor
{
static
class
DataSourceSpyBeanPostProcessor
implements
BeanPostProcessor
{
@Override
@Override
public
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
public
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
{
if
(
bean
instanceof
DataSource
)
{
if
(
bean
instanceof
DataSource
)
{
bean
=
spy
(
bean
);
bean
=
spy
(
bean
);
}
}
...
@@ -169,7 +168,7 @@ abstract class AbstractDevToolsDataSourceAutoConfigurationTests {
...
@@ -169,7 +168,7 @@ abstract class AbstractDevToolsDataSourceAutoConfigurationTests {
}
}
@Override
@Override
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
{
return
bean
;
return
bean
;
}
}
...
...
spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MockRestarter.java
View file @
d3c817b7
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
21
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -24,7 +24,6 @@ import org.junit.jupiter.api.extension.AfterEachCallback;
...
@@ -24,7 +24,6 @@ import org.junit.jupiter.api.extension.AfterEachCallback;
import
org.junit.jupiter.api.extension.BeforeEachCallback
;
import
org.junit.jupiter.api.extension.BeforeEachCallback
;
import
org.junit.jupiter.api.extension.ExtensionContext
;
import
org.junit.jupiter.api.extension.ExtensionContext
;
import
org.junit.jupiter.api.extension.ParameterContext
;
import
org.junit.jupiter.api.extension.ParameterContext
;
import
org.junit.jupiter.api.extension.ParameterResolutionException
;
import
org.junit.jupiter.api.extension.ParameterResolver
;
import
org.junit.jupiter.api.extension.ParameterResolver
;
import
org.springframework.beans.factory.ObjectFactory
;
import
org.springframework.beans.factory.ObjectFactory
;
...
@@ -73,14 +72,12 @@ public class MockRestarter implements BeforeEachCallback, AfterEachCallback, Par
...
@@ -73,14 +72,12 @@ public class MockRestarter implements BeforeEachCallback, AfterEachCallback, Par
}
}
@Override
@Override
public
boolean
supportsParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
public
boolean
supportsParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
{
throws
ParameterResolutionException
{
return
parameterContext
.
getParameter
().
getType
().
equals
(
Restarter
.
class
);
return
parameterContext
.
getParameter
().
getType
().
equals
(
Restarter
.
class
);
}
}
@Override
@Override
public
Object
resolveParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
public
Object
resolveParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
{
throws
ParameterResolutionException
{
return
this
.
mock
;
return
this
.
mock
;
}
}
...
...
spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnContextHierarchyIntegrationTests.java
View file @
d3c817b7
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
21
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -19,7 +19,6 @@ package org.springframework.boot.test.mock.mockito;
...
@@ -19,7 +19,6 @@ package org.springframework.boot.test.mock.mockito;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
import
org.junit.jupiter.api.extension.ExtendWith
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.mock.mockito.MockBeanOnContextHierarchyIntegrationTests.ChildConfig
;
import
org.springframework.boot.test.mock.mockito.MockBeanOnContextHierarchyIntegrationTests.ChildConfig
;
import
org.springframework.boot.test.mock.mockito.MockBeanOnContextHierarchyIntegrationTests.ParentConfig
;
import
org.springframework.boot.test.mock.mockito.MockBeanOnContextHierarchyIntegrationTests.ParentConfig
;
...
@@ -73,7 +72,7 @@ class MockBeanOnContextHierarchyIntegrationTests {
...
@@ -73,7 +72,7 @@ class MockBeanOnContextHierarchyIntegrationTests {
private
ApplicationContext
context
;
private
ApplicationContext
context
;
@Override
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
{
this
.
context
=
applicationContext
;
this
.
context
=
applicationContext
;
}
}
...
...
spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessorTests.java
View file @
d3c817b7
/*
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -22,7 +22,6 @@ import org.junit.jupiter.api.Test;
...
@@ -22,7 +22,6 @@ import org.junit.jupiter.api.Test;
import
org.mockito.Mockito
;
import
org.mockito.Mockito
;
import
org.springframework.beans.BeanWrapper
;
import
org.springframework.beans.BeanWrapper
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.FactoryBean
;
import
org.springframework.beans.factory.FactoryBean
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.config.BeanFactoryPostProcessor
;
import
org.springframework.beans.factory.config.BeanFactoryPostProcessor
;
...
@@ -309,7 +308,7 @@ class MockitoPostProcessorTests {
...
@@ -309,7 +308,7 @@ class MockitoPostProcessorTests {
static
class
FactoryBeanRegisteringPostProcessor
implements
BeanFactoryPostProcessor
,
Ordered
{
static
class
FactoryBeanRegisteringPostProcessor
implements
BeanFactoryPostProcessor
,
Ordered
{
@Override
@Override
public
void
postProcessBeanFactory
(
ConfigurableListableBeanFactory
beanFactory
)
throws
BeansException
{
public
void
postProcessBeanFactory
(
ConfigurableListableBeanFactory
beanFactory
)
{
RootBeanDefinition
beanDefinition
=
new
RootBeanDefinition
(
TestFactoryBean
.
class
);
RootBeanDefinition
beanDefinition
=
new
RootBeanDefinition
(
TestFactoryBean
.
class
);
((
BeanDefinitionRegistry
)
beanFactory
).
registerBeanDefinition
(
"test"
,
beanDefinition
);
((
BeanDefinitionRegistry
)
beanFactory
).
registerBeanDefinition
(
"test"
,
beanDefinition
);
}
}
...
@@ -325,7 +324,7 @@ class MockitoPostProcessorTests {
...
@@ -325,7 +324,7 @@ class MockitoPostProcessorTests {
@Override
@Override
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
public
void
postProcessBeanFactory
(
ConfigurableListableBeanFactory
beanFactory
)
throws
BeansException
{
public
void
postProcessBeanFactory
(
ConfigurableListableBeanFactory
beanFactory
)
{
Map
<
String
,
BeanWrapper
>
cache
=
(
Map
<
String
,
BeanWrapper
>)
ReflectionTestUtils
.
getField
(
beanFactory
,
Map
<
String
,
BeanWrapper
>
cache
=
(
Map
<
String
,
BeanWrapper
>)
ReflectionTestUtils
.
getField
(
beanFactory
,
"factoryBeanInstanceCache"
);
"factoryBeanInstanceCache"
);
Assert
.
isTrue
(
cache
.
isEmpty
(),
"Early initialization of factory bean triggered."
);
Assert
.
isTrue
(
cache
.
isEmpty
(),
"Early initialization of factory bean triggered."
);
...
...
spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnContextHierarchyIntegrationTests.java
View file @
d3c817b7
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
21
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -19,7 +19,6 @@ package org.springframework.boot.test.mock.mockito;
...
@@ -19,7 +19,6 @@ package org.springframework.boot.test.mock.mockito;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
import
org.junit.jupiter.api.extension.ExtendWith
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.mock.mockito.SpyBeanOnContextHierarchyIntegrationTests.ChildConfig
;
import
org.springframework.boot.test.mock.mockito.SpyBeanOnContextHierarchyIntegrationTests.ChildConfig
;
import
org.springframework.boot.test.mock.mockito.SpyBeanOnContextHierarchyIntegrationTests.ParentConfig
;
import
org.springframework.boot.test.mock.mockito.SpyBeanOnContextHierarchyIntegrationTests.ParentConfig
;
...
@@ -74,7 +73,7 @@ class SpyBeanOnContextHierarchyIntegrationTests {
...
@@ -74,7 +73,7 @@ class SpyBeanOnContextHierarchyIntegrationTests {
private
ApplicationContext
context
;
private
ApplicationContext
context
;
@Override
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
{
this
.
context
=
applicationContext
;
this
.
context
=
applicationContext
;
}
}
...
...
spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/NoTestRestTemplateBeanChecker.java
View file @
d3c817b7
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
21
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -16,7 +16,6 @@
...
@@ -16,7 +16,6 @@
package
org
.
springframework
.
boot
.
test
.
web
.
client
;
package
org
.
springframework
.
boot
.
test
.
web
.
client
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.BeanFactory
;
import
org.springframework.beans.factory.BeanFactory
;
import
org.springframework.beans.factory.BeanFactoryAware
;
import
org.springframework.beans.factory.BeanFactoryAware
;
import
org.springframework.beans.factory.BeanFactoryUtils
;
import
org.springframework.beans.factory.BeanFactoryUtils
;
...
@@ -33,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -33,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class
NoTestRestTemplateBeanChecker
implements
ImportSelector
,
BeanFactoryAware
{
class
NoTestRestTemplateBeanChecker
implements
ImportSelector
,
BeanFactoryAware
{
@Override
@Override
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
throws
BeansException
{
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
{
assertThat
(
BeanFactoryUtils
.
beanNamesForTypeIncludingAncestors
((
ListableBeanFactory
)
beanFactory
,
assertThat
(
BeanFactoryUtils
.
beanNamesForTypeIncludingAncestors
((
ListableBeanFactory
)
beanFactory
,
TestRestTemplate
.
class
)).
isEmpty
();
TestRestTemplate
.
class
)).
isEmpty
();
}
}
...
...
spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/TestRestTemplateContextCustomizerTests.java
View file @
d3c817b7
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
21
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -18,7 +18,6 @@ package org.springframework.boot.test.web.client;
...
@@ -18,7 +18,6 @@ package org.springframework.boot.test.web.client;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.config.ConfigurableListableBeanFactory
;
import
org.springframework.beans.factory.config.ConfigurableListableBeanFactory
;
import
org.springframework.beans.factory.support.DefaultListableBeanFactory
;
import
org.springframework.beans.factory.support.DefaultListableBeanFactory
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest
;
...
@@ -58,7 +57,7 @@ class TestRestTemplateContextCustomizerTests {
...
@@ -58,7 +57,7 @@ class TestRestTemplateContextCustomizerTests {
private
final
ConfigurableListableBeanFactory
beanFactory
=
new
DefaultListableBeanFactory
();
private
final
ConfigurableListableBeanFactory
beanFactory
=
new
DefaultListableBeanFactory
();
@Override
@Override
protected
void
refreshBeanFactory
()
throws
BeansException
,
IllegalStateException
{
protected
void
refreshBeanFactory
()
{
}
}
@Override
@Override
...
@@ -67,7 +66,7 @@ class TestRestTemplateContextCustomizerTests {
...
@@ -67,7 +66,7 @@ class TestRestTemplateContextCustomizerTests {
}
}
@Override
@Override
public
ConfigurableListableBeanFactory
getBeanFactory
()
throws
IllegalStateException
{
public
ConfigurableListableBeanFactory
getBeanFactory
()
{
return
this
.
beanFactory
;
return
this
.
beanFactory
;
}
}
...
...
spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/TestRestTemplateTests.java
View file @
d3c817b7
...
@@ -150,7 +150,7 @@ class TestRestTemplateTests {
...
@@ -150,7 +150,7 @@ class TestRestTemplateTests {
ReflectionUtils
.
doWithMethods
(
RestOperations
.
class
,
new
MethodCallback
()
{
ReflectionUtils
.
doWithMethods
(
RestOperations
.
class
,
new
MethodCallback
()
{
@Override
@Override
public
void
doWith
(
Method
method
)
throws
IllegalArgumentException
{
public
void
doWith
(
Method
method
)
{
Method
equivalent
=
ReflectionUtils
.
findMethod
(
TestRestTemplate
.
class
,
method
.
getName
(),
Method
equivalent
=
ReflectionUtils
.
findMethod
(
TestRestTemplate
.
class
,
method
.
getName
(),
method
.
getParameterTypes
());
method
.
getParameterTypes
());
assertThat
(
equivalent
).
as
(
"Method %s not found"
,
method
).
isNotNull
();
assertThat
(
equivalent
).
as
(
"Method %s not found"
,
method
).
isNotNull
();
...
...
spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/reactive/server/NoWebTestClientBeanChecker.java
View file @
d3c817b7
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
21
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -16,7 +16,6 @@
...
@@ -16,7 +16,6 @@
package
org
.
springframework
.
boot
.
test
.
web
.
reactive
.
server
;
package
org
.
springframework
.
boot
.
test
.
web
.
reactive
.
server
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.BeanFactory
;
import
org.springframework.beans.factory.BeanFactory
;
import
org.springframework.beans.factory.BeanFactoryAware
;
import
org.springframework.beans.factory.BeanFactoryAware
;
import
org.springframework.beans.factory.BeanFactoryUtils
;
import
org.springframework.beans.factory.BeanFactoryUtils
;
...
@@ -34,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -34,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class
NoWebTestClientBeanChecker
implements
ImportSelector
,
BeanFactoryAware
{
class
NoWebTestClientBeanChecker
implements
ImportSelector
,
BeanFactoryAware
{
@Override
@Override
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
throws
BeansException
{
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
{
assertThat
(
BeanFactoryUtils
.
beanNamesForTypeIncludingAncestors
((
ListableBeanFactory
)
beanFactory
,
assertThat
(
BeanFactoryUtils
.
beanNamesForTypeIncludingAncestors
((
ListableBeanFactory
)
beanFactory
,
WebTestClient
.
class
)).
isEmpty
();
WebTestClient
.
class
)).
isEmpty
();
}
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfoIntegrationTests.java
View file @
d3c817b7
...
@@ -26,9 +26,7 @@ import java.nio.file.StandardOpenOption;
...
@@ -26,9 +26,7 @@ import java.nio.file.StandardOpenOption;
import
java.time.Instant
;
import
java.time.Instant
;
import
java.util.Properties
;
import
java.util.Properties
;
import
org.gradle.testkit.runner.InvalidRunnerConfigurationException
;
import
org.gradle.testkit.runner.TaskOutcome
;
import
org.gradle.testkit.runner.TaskOutcome
;
import
org.gradle.testkit.runner.UnexpectedBuildFailure
;
import
org.junit.jupiter.api.TestTemplate
;
import
org.junit.jupiter.api.TestTemplate
;
import
org.springframework.boot.gradle.junit.GradleCompatibility
;
import
org.springframework.boot.gradle.junit.GradleCompatibility
;
...
@@ -111,8 +109,7 @@ class BuildInfoIntegrationTests {
...
@@ -111,8 +109,7 @@ class BuildInfoIntegrationTests {
}
}
@TestTemplate
@TestTemplate
void
reproducibleOutputWithFixedTime
()
void
reproducibleOutputWithFixedTime
()
throws
IOException
,
InterruptedException
{
throws
InvalidRunnerConfigurationException
,
UnexpectedBuildFailure
,
IOException
,
InterruptedException
{
assertThat
(
this
.
gradleBuild
.
build
(
"buildInfo"
,
"-PnullTime"
).
task
(
":buildInfo"
).
getOutcome
())
assertThat
(
this
.
gradleBuild
.
build
(
"buildInfo"
,
"-PnullTime"
).
task
(
":buildInfo"
).
getOutcome
())
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
File
buildInfoProperties
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/build-info.properties"
);
File
buildInfoProperties
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/build-info.properties"
);
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveIntegrationTests.java
View file @
d3c817b7
...
@@ -46,9 +46,7 @@ import java.util.stream.Stream;
...
@@ -46,9 +46,7 @@ import java.util.stream.Stream;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipEntry
;
import
org.gradle.testkit.runner.BuildResult
;
import
org.gradle.testkit.runner.BuildResult
;
import
org.gradle.testkit.runner.InvalidRunnerConfigurationException
;
import
org.gradle.testkit.runner.TaskOutcome
;
import
org.gradle.testkit.runner.TaskOutcome
;
import
org.gradle.testkit.runner.UnexpectedBuildFailure
;
import
org.junit.jupiter.api.TestTemplate
;
import
org.junit.jupiter.api.TestTemplate
;
import
org.springframework.boot.gradle.testkit.GradleBuild
;
import
org.springframework.boot.gradle.testkit.GradleBuild
;
...
@@ -92,8 +90,7 @@ abstract class AbstractBootArchiveIntegrationTests {
...
@@ -92,8 +90,7 @@ abstract class AbstractBootArchiveIntegrationTests {
}
}
@TestTemplate
@TestTemplate
void
reproducibleArchive
()
void
reproducibleArchive
()
throws
IOException
,
InterruptedException
{
throws
InvalidRunnerConfigurationException
,
UnexpectedBuildFailure
,
IOException
,
InterruptedException
{
assertThat
(
this
.
gradleBuild
.
build
(
this
.
taskName
).
task
(
":"
+
this
.
taskName
).
getOutcome
())
assertThat
(
this
.
gradleBuild
.
build
(
this
.
taskName
).
task
(
":"
+
this
.
taskName
).
getOutcome
())
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
File
jar
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/libs"
).
listFiles
()[
0
];
File
jar
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/libs"
).
listFiles
()[
0
];
...
@@ -229,8 +226,7 @@ abstract class AbstractBootArchiveIntegrationTests {
...
@@ -229,8 +226,7 @@ abstract class AbstractBootArchiveIntegrationTests {
}
}
@TestTemplate
@TestTemplate
void
upToDateWhenBuiltWithDefaultLayeredAndThenWithExplicitLayered
()
void
upToDateWhenBuiltWithDefaultLayeredAndThenWithExplicitLayered
()
{
throws
InvalidRunnerConfigurationException
,
UnexpectedBuildFailure
{
assertThat
(
this
.
gradleBuild
.
scriptProperty
(
"layered"
,
""
).
build
(
""
+
this
.
taskName
).
task
(
":"
+
this
.
taskName
)
assertThat
(
this
.
gradleBuild
.
scriptProperty
(
"layered"
,
""
).
build
(
""
+
this
.
taskName
).
task
(
":"
+
this
.
taskName
)
.
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
this
.
gradleBuild
.
scriptProperty
(
"layered"
,
"layered {}"
).
build
(
""
+
this
.
taskName
)
assertThat
(
this
.
gradleBuild
.
scriptProperty
(
"layered"
,
"layered {}"
).
build
(
""
+
this
.
taskName
)
...
@@ -238,8 +234,7 @@ abstract class AbstractBootArchiveIntegrationTests {
...
@@ -238,8 +234,7 @@ abstract class AbstractBootArchiveIntegrationTests {
}
}
@TestTemplate
@TestTemplate
void
notUpToDateWhenBuiltWithoutLayersAndThenWithLayers
()
void
notUpToDateWhenBuiltWithoutLayersAndThenWithLayers
()
{
throws
InvalidRunnerConfigurationException
,
UnexpectedBuildFailure
{
assertThat
(
this
.
gradleBuild
.
scriptProperty
(
"layerEnablement"
,
"enabled = false"
).
build
(
this
.
taskName
)
assertThat
(
this
.
gradleBuild
.
scriptProperty
(
"layerEnablement"
,
"enabled = false"
).
build
(
this
.
taskName
)
.
task
(
":"
+
this
.
taskName
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
task
(
":"
+
this
.
taskName
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
this
.
gradleBuild
.
scriptProperty
(
"layerEnablement"
,
"enabled = true"
).
build
(
this
.
taskName
)
assertThat
(
this
.
gradleBuild
.
scriptProperty
(
"layerEnablement"
,
"enabled = true"
).
build
(
this
.
taskName
)
...
@@ -247,8 +242,7 @@ abstract class AbstractBootArchiveIntegrationTests {
...
@@ -247,8 +242,7 @@ abstract class AbstractBootArchiveIntegrationTests {
}
}
@TestTemplate
@TestTemplate
void
notUpToDateWhenBuiltWithLayerToolsAndThenWithoutLayerTools
()
void
notUpToDateWhenBuiltWithLayerToolsAndThenWithoutLayerTools
()
{
throws
InvalidRunnerConfigurationException
,
UnexpectedBuildFailure
{
assertThat
(
this
.
gradleBuild
.
scriptProperty
(
"layerTools"
,
""
).
build
(
this
.
taskName
).
task
(
":"
+
this
.
taskName
)
assertThat
(
this
.
gradleBuild
.
scriptProperty
(
"layerTools"
,
""
).
build
(
this
.
taskName
).
task
(
":"
+
this
.
taskName
)
.
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
.
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
this
.
gradleBuild
.
scriptProperty
(
"layerTools"
,
"includeLayerTools = false"
).
build
(
this
.
taskName
)
assertThat
(
this
.
gradleBuild
.
scriptProperty
(
"layerTools"
,
"includeLayerTools = false"
).
build
(
this
.
taskName
)
...
...
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/MavenBuildExtension.java
View file @
d3c817b7
/*
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -27,7 +27,6 @@ import java.util.stream.Stream;
...
@@ -27,7 +27,6 @@ import java.util.stream.Stream;
import
org.junit.jupiter.api.extension.Extension
;
import
org.junit.jupiter.api.extension.Extension
;
import
org.junit.jupiter.api.extension.ExtensionContext
;
import
org.junit.jupiter.api.extension.ExtensionContext
;
import
org.junit.jupiter.api.extension.ParameterContext
;
import
org.junit.jupiter.api.extension.ParameterContext
;
import
org.junit.jupiter.api.extension.ParameterResolutionException
;
import
org.junit.jupiter.api.extension.ParameterResolver
;
import
org.junit.jupiter.api.extension.ParameterResolver
;
import
org.junit.jupiter.api.extension.TestTemplateInvocationContext
;
import
org.junit.jupiter.api.extension.TestTemplateInvocationContext
;
import
org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider
;
import
org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider
;
...
@@ -84,14 +83,12 @@ class MavenBuildExtension implements TestTemplateInvocationContextProvider {
...
@@ -84,14 +83,12 @@ class MavenBuildExtension implements TestTemplateInvocationContextProvider {
}
}
@Override
@Override
public
boolean
supportsParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
public
boolean
supportsParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
{
throws
ParameterResolutionException
{
return
parameterContext
.
getParameter
().
getType
().
equals
(
MavenBuild
.
class
);
return
parameterContext
.
getParameter
().
getType
().
equals
(
MavenBuild
.
class
);
}
}
@Override
@Override
public
Object
resolveParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
public
Object
resolveParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
{
throws
ParameterResolutionException
{
return
new
MavenBuild
(
this
.
mavenHome
.
toFile
());
return
new
MavenBuild
(
this
.
mavenHome
.
toFile
());
}
}
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java
View file @
d3c817b7
...
@@ -40,7 +40,6 @@ import org.mockito.InOrder;
...
@@ -40,7 +40,6 @@ import org.mockito.InOrder;
import
org.mockito.Mockito
;
import
org.mockito.Mockito
;
import
reactor.core.publisher.Mono
;
import
reactor.core.publisher.Mono
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.CachedIntrospectionResults
;
import
org.springframework.beans.CachedIntrospectionResults
;
import
org.springframework.beans.factory.BeanCreationException
;
import
org.springframework.beans.factory.BeanCreationException
;
import
org.springframework.beans.factory.config.ConfigurableListableBeanFactory
;
import
org.springframework.beans.factory.config.ConfigurableListableBeanFactory
;
...
@@ -1659,7 +1658,7 @@ class SpringApplicationTests {
...
@@ -1659,7 +1658,7 @@ class SpringApplicationTests {
}
}
@Override
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
{
this
.
applicationContext
=
applicationContext
;
this
.
applicationContext
=
applicationContext
;
}
}
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorImportCombinedWithProfileSpecificIntegrationTests.java
View file @
d3c817b7
...
@@ -82,14 +82,13 @@ class ConfigDataEnvironmentPostProcessorImportCombinedWithProfileSpecificIntegra
...
@@ -82,14 +82,13 @@ class ConfigDataEnvironmentPostProcessorImportCombinedWithProfileSpecificIntegra
}
}
@Override
@Override
public
List
<
Resource
>
resolve
(
ConfigDataLocationResolverContext
context
,
ConfigDataLocation
location
)
public
List
<
Resource
>
resolve
(
ConfigDataLocationResolverContext
context
,
ConfigDataLocation
location
)
{
throws
ConfigDataLocationNotFoundException
,
ConfigDataResourceNotFoundException
{
return
Collections
.
emptyList
();
return
Collections
.
emptyList
();
}
}
@Override
@Override
public
List
<
Resource
>
resolveProfileSpecific
(
ConfigDataLocationResolverContext
context
,
public
List
<
Resource
>
resolveProfileSpecific
(
ConfigDataLocationResolverContext
context
,
ConfigDataLocation
location
,
Profiles
profiles
)
throws
ConfigDataLocationNotFoundException
{
ConfigDataLocation
location
,
Profiles
profiles
)
{
return
Collections
.
singletonList
(
new
Resource
(
profiles
));
return
Collections
.
singletonList
(
new
Resource
(
profiles
));
}
}
...
@@ -98,8 +97,7 @@ class ConfigDataEnvironmentPostProcessorImportCombinedWithProfileSpecificIntegra
...
@@ -98,8 +97,7 @@ class ConfigDataEnvironmentPostProcessorImportCombinedWithProfileSpecificIntegra
static
class
Loader
implements
ConfigDataLoader
<
Resource
>
{
static
class
Loader
implements
ConfigDataLoader
<
Resource
>
{
@Override
@Override
public
ConfigData
load
(
ConfigDataLoaderContext
context
,
Resource
resource
)
public
ConfigData
load
(
ConfigDataLoaderContext
context
,
Resource
resource
)
throws
IOException
{
throws
IOException
,
ConfigDataResourceNotFoundException
{
List
<
PropertySource
<?>>
propertySources
=
new
ArrayList
<>();
List
<
PropertySource
<?>>
propertySources
=
new
ArrayList
<>();
Map
<
PropertySource
<?>,
Options
>
propertySourceOptions
=
new
HashMap
<>();
Map
<
PropertySource
<?>,
Options
>
propertySourceOptions
=
new
HashMap
<>();
propertySources
.
add
(
new
MapPropertySource
(
"icwps1"
,
Collections
.
singletonMap
(
"prop"
,
"fromicwps1"
)));
propertySources
.
add
(
new
MapPropertySource
(
"icwps1"
,
Collections
.
singletonMap
(
"prop"
,
"fromicwps1"
)));
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataLocationResolversTests.java
View file @
d3c817b7
...
@@ -179,14 +179,13 @@ class ConfigDataLocationResolversTests {
...
@@ -179,14 +179,13 @@ class ConfigDataLocationResolversTests {
@Override
@Override
public
List
<
TestConfigDataResource
>
resolve
(
ConfigDataLocationResolverContext
context
,
public
List
<
TestConfigDataResource
>
resolve
(
ConfigDataLocationResolverContext
context
,
ConfigDataLocation
location
)
ConfigDataLocation
location
)
{
throws
ConfigDataLocationNotFoundException
,
ConfigDataResourceNotFoundException
{
return
Collections
.
singletonList
(
new
TestConfigDataResource
(
this
,
location
,
false
));
return
Collections
.
singletonList
(
new
TestConfigDataResource
(
this
,
location
,
false
));
}
}
@Override
@Override
public
List
<
TestConfigDataResource
>
resolveProfileSpecific
(
ConfigDataLocationResolverContext
context
,
public
List
<
TestConfigDataResource
>
resolveProfileSpecific
(
ConfigDataLocationResolverContext
context
,
ConfigDataLocation
location
,
Profiles
profiles
)
throws
ConfigDataLocationNotFoundException
{
ConfigDataLocation
location
,
Profiles
profiles
)
{
return
Collections
.
singletonList
(
new
TestConfigDataResource
(
this
,
location
,
true
));
return
Collections
.
singletonList
(
new
TestConfigDataResource
(
this
,
location
,
true
));
}
}
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/logging/LoggingApplicationListenerTests.java
View file @
d3c817b7
...
@@ -117,7 +117,7 @@ class LoggingApplicationListenerTests {
...
@@ -117,7 +117,7 @@ class LoggingApplicationListenerTests {
private
CapturedOutput
output
;
private
CapturedOutput
output
;
@BeforeEach
@BeforeEach
void
init
(
CapturedOutput
output
)
throws
SecurityException
,
IOException
{
void
init
(
CapturedOutput
output
)
throws
IOException
{
this
.
systemPropertyNames
=
new
HashSet
<>(
System
.
getProperties
().
keySet
());
this
.
systemPropertyNames
=
new
HashSet
<>(
System
.
getProperties
().
keySet
());
this
.
output
=
output
;
this
.
output
=
output
;
this
.
logFile
=
new
File
(
this
.
tempDir
.
toFile
(),
"foo.log"
);
this
.
logFile
=
new
File
(
this
.
tempDir
.
toFile
(),
"foo.log"
);
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java
View file @
d3c817b7
...
@@ -41,7 +41,6 @@ import org.junit.jupiter.api.AfterEach;
...
@@ -41,7 +41,6 @@ import org.junit.jupiter.api.AfterEach;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
import
org.junit.jupiter.api.extension.ExtendWith
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.BeanCreationException
;
import
org.springframework.beans.factory.BeanCreationException
;
import
org.springframework.beans.factory.FactoryBean
;
import
org.springframework.beans.factory.FactoryBean
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.InitializingBean
;
...
@@ -382,7 +381,7 @@ class ConfigurationPropertiesTests {
...
@@ -382,7 +381,7 @@ class ConfigurationPropertiesTests {
this
.
context
=
new
AnnotationConfigApplicationContext
()
{
this
.
context
=
new
AnnotationConfigApplicationContext
()
{
@Override
@Override
protected
void
onRefresh
()
throws
BeansException
{
protected
void
onRefresh
()
{
assertThat
(
WithFactoryBeanConfiguration
.
factoryBeanInitialized
).
as
(
"Initialized too early"
).
isFalse
();
assertThat
(
WithFactoryBeanConfiguration
.
factoryBeanInitialized
).
as
(
"Initialized too early"
).
isFalse
();
super
.
onRefresh
();
super
.
onRefresh
();
}
}
...
@@ -2298,7 +2297,7 @@ class ConfigurationPropertiesTests {
...
@@ -2298,7 +2297,7 @@ class ConfigurationPropertiesTests {
static
class
PersonPropertyEditor
extends
PropertyEditorSupport
{
static
class
PersonPropertyEditor
extends
PropertyEditorSupport
{
@Override
@Override
public
void
setAsText
(
String
text
)
throws
IllegalArgumentException
{
public
void
setAsText
(
String
text
)
{
String
[]
content
=
text
.
split
(
","
);
String
[]
content
=
text
.
split
(
","
);
setValue
(
new
Person
(
content
[
1
],
content
[
0
]));
setValue
(
new
Person
(
content
[
1
],
content
[
0
]));
}
}
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BindConverterTests.java
View file @
d3c817b7
...
@@ -206,7 +206,7 @@ class BindConverterTests {
...
@@ -206,7 +206,7 @@ class BindConverterTests {
static
class
SampleTypePropertyEditor
extends
PropertyEditorSupport
{
static
class
SampleTypePropertyEditor
extends
PropertyEditorSupport
{
@Override
@Override
public
void
setAsText
(
String
text
)
throws
IllegalArgumentException
{
public
void
setAsText
(
String
text
)
{
SampleType
value
=
new
SampleType
();
SampleType
value
=
new
SampleType
();
value
.
text
=
text
;
value
.
text
=
text
;
setValue
(
value
);
setValue
(
value
);
...
@@ -238,7 +238,7 @@ class BindConverterTests {
...
@@ -238,7 +238,7 @@ class BindConverterTests {
static
class
ConventionTypeEditor
extends
PropertyEditorSupport
{
static
class
ConventionTypeEditor
extends
PropertyEditorSupport
{
@Override
@Override
public
void
setAsText
(
String
text
)
throws
IllegalArgumentException
{
public
void
setAsText
(
String
text
)
{
ConventionType
value
=
new
ConventionType
();
ConventionType
value
=
new
ConventionType
();
value
.
text
=
text
;
value
.
text
=
text
;
setValue
(
value
);
setValue
(
value
);
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BinderTests.java
View file @
d3c817b7
...
@@ -461,7 +461,7 @@ class BinderTests {
...
@@ -461,7 +461,7 @@ class BinderTests {
static
class
JavaBeanPropertyEditor
extends
PropertyEditorSupport
{
static
class
JavaBeanPropertyEditor
extends
PropertyEditorSupport
{
@Override
@Override
public
void
setAsText
(
String
text
)
throws
IllegalArgumentException
{
public
void
setAsText
(
String
text
)
{
JavaBean
value
=
new
JavaBean
();
JavaBean
value
=
new
JavaBean
();
value
.
setValue
(
text
);
value
.
setValue
(
text
);
setValue
(
value
);
setValue
(
value
);
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/FailureAnalyzersTests.java
View file @
d3c817b7
/*
/*
* Copyright 2012-202
0
the original author or authors.
* Copyright 2012-202
1
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -23,7 +23,6 @@ import java.util.Enumeration;
...
@@ -23,7 +23,6 @@ import java.util.Enumeration;
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.springframework.beans.BeansException
;
import
org.springframework.beans.factory.BeanFactory
;
import
org.springframework.beans.factory.BeanFactory
;
import
org.springframework.beans.factory.BeanFactoryAware
;
import
org.springframework.beans.factory.BeanFactoryAware
;
import
org.springframework.context.EnvironmentAware
;
import
org.springframework.context.EnvironmentAware
;
...
@@ -146,7 +145,7 @@ class FailureAnalyzersTests {
...
@@ -146,7 +145,7 @@ class FailureAnalyzersTests {
}
}
@Override
@Override
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
throws
BeansException
{
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
{
failureAnalyzer
.
setBeanFactory
(
beanFactory
);
failureAnalyzer
.
setBeanFactory
(
beanFactory
);
}
}
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/java/JavaLoggingSystemTests.java
View file @
d3c817b7
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
21
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -61,7 +61,7 @@ class JavaLoggingSystemTests extends AbstractLoggingSystemTests {
...
@@ -61,7 +61,7 @@ class JavaLoggingSystemTests extends AbstractLoggingSystemTests {
private
Locale
defaultLocale
;
private
Locale
defaultLocale
;
@BeforeEach
@BeforeEach
void
init
()
throws
SecurityException
{
void
init
()
{
this
.
logger
=
Logger
.
getLogger
(
getClass
().
getName
());
this
.
logger
=
Logger
.
getLogger
(
getClass
().
getName
());
this
.
defaultLocale
=
Locale
.
getDefault
();
this
.
defaultLocale
=
Locale
.
getDefault
();
Locale
.
setDefault
(
Locale
.
ENGLISH
);
Locale
.
setDefault
(
Locale
.
ENGLISH
);
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/MockReactiveWebServerFactory.java
View file @
d3c817b7
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
21
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -19,7 +19,6 @@ package org.springframework.boot.web.reactive.server;
...
@@ -19,7 +19,6 @@ package org.springframework.boot.web.reactive.server;
import
java.util.Map
;
import
java.util.Map
;
import
org.springframework.boot.web.server.WebServer
;
import
org.springframework.boot.web.server.WebServer
;
import
org.springframework.boot.web.server.WebServerException
;
import
org.springframework.http.server.reactive.HttpHandler
;
import
org.springframework.http.server.reactive.HttpHandler
;
import
static
org
.
mockito
.
Mockito
.
spy
;
import
static
org
.
mockito
.
Mockito
.
spy
;
...
@@ -70,12 +69,12 @@ public class MockReactiveWebServerFactory extends AbstractReactiveWebServerFacto
...
@@ -70,12 +69,12 @@ public class MockReactiveWebServerFactory extends AbstractReactiveWebServerFacto
}
}
@Override
@Override
public
void
start
()
throws
WebServerException
{
public
void
start
()
{
}
}
@Override
@Override
public
void
stop
()
throws
WebServerException
{
public
void
stop
()
{
}
}
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/MockServletWebServerFactory.java
View file @
d3c817b7
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
21
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -23,7 +23,6 @@ import javax.servlet.ServletContext;
...
@@ -23,7 +23,6 @@ import javax.servlet.ServletContext;
import
org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredFilter
;
import
org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredFilter
;
import
org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredServlet
;
import
org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredServlet
;
import
org.springframework.boot.web.server.WebServer
;
import
org.springframework.boot.web.server.WebServer
;
import
org.springframework.boot.web.server.WebServerException
;
import
org.springframework.boot.web.servlet.ServletContextInitializer
;
import
org.springframework.boot.web.servlet.ServletContextInitializer
;
import
static
org
.
mockito
.
Mockito
.
spy
;
import
static
org
.
mockito
.
Mockito
.
spy
;
...
@@ -69,7 +68,7 @@ public class MockServletWebServerFactory extends AbstractServletWebServerFactory
...
@@ -69,7 +68,7 @@ public class MockServletWebServerFactory extends AbstractServletWebServerFactory
}
}
@Override
@Override
public
void
start
()
throws
WebServerException
{
public
void
start
()
{
}
}
}
}
...
...
spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/test/java/org/springframework/boot/context/embedded/EmbeddedServerContainerInvocationContextProvider.java
View file @
d3c817b7
...
@@ -34,7 +34,6 @@ import org.junit.jupiter.api.extension.AfterAllCallback;
...
@@ -34,7 +34,6 @@ import org.junit.jupiter.api.extension.AfterAllCallback;
import
org.junit.jupiter.api.extension.Extension
;
import
org.junit.jupiter.api.extension.Extension
;
import
org.junit.jupiter.api.extension.ExtensionContext
;
import
org.junit.jupiter.api.extension.ExtensionContext
;
import
org.junit.jupiter.api.extension.ParameterContext
;
import
org.junit.jupiter.api.extension.ParameterContext
;
import
org.junit.jupiter.api.extension.ParameterResolutionException
;
import
org.junit.jupiter.api.extension.ParameterResolver
;
import
org.junit.jupiter.api.extension.ParameterResolver
;
import
org.junit.jupiter.api.extension.TestTemplateInvocationContext
;
import
org.junit.jupiter.api.extension.TestTemplateInvocationContext
;
import
org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider
;
import
org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider
;
...
@@ -150,8 +149,7 @@ class EmbeddedServerContainerInvocationContextProvider
...
@@ -150,8 +149,7 @@ class EmbeddedServerContainerInvocationContextProvider
}
}
@Override
@Override
public
boolean
supportsParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
public
boolean
supportsParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
{
throws
ParameterResolutionException
{
if
(
parameterContext
.
getParameter
().
getType
().
equals
(
AbstractApplicationLauncher
.
class
))
{
if
(
parameterContext
.
getParameter
().
getType
().
equals
(
AbstractApplicationLauncher
.
class
))
{
return
true
;
return
true
;
}
}
...
@@ -162,8 +160,7 @@ class EmbeddedServerContainerInvocationContextProvider
...
@@ -162,8 +160,7 @@ class EmbeddedServerContainerInvocationContextProvider
}
}
@Override
@Override
public
Object
resolveParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
public
Object
resolveParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
{
throws
ParameterResolutionException
{
if
(
parameterContext
.
getParameter
().
getType
().
equals
(
AbstractApplicationLauncher
.
class
))
{
if
(
parameterContext
.
getParameter
().
getType
().
equals
(
AbstractApplicationLauncher
.
class
))
{
return
this
.
launcher
;
return
this
.
launcher
;
}
}
...
@@ -181,14 +178,12 @@ class EmbeddedServerContainerInvocationContextProvider
...
@@ -181,14 +178,12 @@ class EmbeddedServerContainerInvocationContextProvider
}
}
@Override
@Override
public
boolean
supportsParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
public
boolean
supportsParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
{
throws
ParameterResolutionException
{
return
parameterContext
.
getParameter
().
getType
().
equals
(
RestTemplate
.
class
);
return
parameterContext
.
getParameter
().
getType
().
equals
(
RestTemplate
.
class
);
}
}
@Override
@Override
public
Object
resolveParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
public
Object
resolveParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
{
throws
ParameterResolutionException
{
RestTemplate
rest
=
new
RestTemplate
(
new
HttpComponentsClientHttpRequestFactory
(
RestTemplate
rest
=
new
RestTemplate
(
new
HttpComponentsClientHttpRequestFactory
(
HttpClients
.
custom
().
setRetryHandler
(
new
StandardHttpRequestRetryHandler
(
10
,
false
)).
build
()));
HttpClients
.
custom
().
setRetryHandler
(
new
StandardHttpRequestRetryHandler
(
10
,
false
)).
build
()));
rest
.
setErrorHandler
(
new
ResponseErrorHandler
()
{
rest
.
setErrorHandler
(
new
ResponseErrorHandler
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment