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
Show 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");
* you may not use this file except in compliance with the License.
...
...
@@ -65,7 +65,7 @@ class HeapDumpWebEndpointDocumentationTests extends MockMvcEndpointDocumentation
return
new
HeapDumpWebEndpoint
()
{
@Override
protected
HeapDumper
createHeapDumper
()
throws
HeapDumperUnavailableException
{
protected
HeapDumper
createHeapDumper
()
{
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");
* you may not use this file except in compliance with the License.
...
...
@@ -26,7 +26,6 @@ import io.micrometer.core.instrument.composite.CompositeMeterRegistry;
import
org.junit.jupiter.api.Test
;
import
org.slf4j.impl.StaticLoggerBinder
;
import
org.springframework.beans.BeansException
;
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.jmx.JmxMetricsExportAutoConfiguration
;
...
...
@@ -134,7 +133,7 @@ class MeterRegistryConfigurerIntegrationTests {
return
new
BeanPostProcessor
()
{
@Override
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
{
if
(
bean
instanceof
Bravo
)
{
MeterRegistry
meterRegistry
=
context
.
getBean
(
MeterRegistry
.
class
);
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;
import
org.junit.jupiter.api.Test
;
import
org.springframework.aop.framework.ProxyFactory
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
...
...
@@ -312,7 +311,7 @@ class DataSourcePoolMetricsAutoConfigurationTests {
}
@Override
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
{
if
(
bean
instanceof
HikariDataSource
)
{
try
{
((
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;
import
org.junit.jupiter.api.Test
;
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.web.WebEndpointAutoConfiguration
;
import
org.springframework.boot.actuate.autoconfigure.env.EnvironmentEndpointAutoConfiguration
;
...
...
@@ -199,7 +198,7 @@ class ReactiveManagementWebSecurityAutoConfigurationTests {
static
class
TestServerHttpSecurity
extends
ServerHttpSecurity
implements
ApplicationContextAware
{
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
public
void
setApplicationContext
(
ApplicationContext
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");
* you may not use this file except in compliance with the License.
...
...
@@ -21,7 +21,6 @@ import java.util.Map;
import
org.springframework.boot.web.reactive.server.AbstractReactiveWebServerFactory
;
import
org.springframework.boot.web.reactive.server.ReactiveWebServerFactory
;
import
org.springframework.boot.web.server.WebServer
;
import
org.springframework.boot.web.server.WebServerException
;
import
org.springframework.http.server.reactive.HttpHandler
;
import
static
org
.
mockito
.
Mockito
.
spy
;
...
...
@@ -72,12 +71,12 @@ class MockReactiveWebServerFactory extends AbstractReactiveWebServerFactory {
}
@Override
public
void
start
()
throws
WebServerException
{
public
void
start
()
{
}
@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");
* you may not use this file except in compliance with the License.
...
...
@@ -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.RegisteredServlet
;
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.server.AbstractServletWebServerFactory
;
import
org.springframework.boot.web.servlet.server.ServletWebServerFactory
;
...
...
@@ -71,7 +70,7 @@ public class MockServletWebServerFactory extends AbstractServletWebServerFactory
}
@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;
import
org.springframework.boot.actuate.endpoint.InvocationContext
;
import
org.springframework.boot.actuate.endpoint.OperationArgumentResolver
;
import
org.springframework.boot.actuate.endpoint.SecurityContext
;
import
org.springframework.boot.actuate.endpoint.invoke.MissingParametersException
;
import
org.springframework.boot.actuate.endpoint.invoke.OperationInvoker
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
...
@@ -221,7 +220,7 @@ class CachingOperationInvokerTests {
static
AtomicInteger
invocations
=
new
AtomicInteger
();
@Override
public
Mono
<
String
>
invoke
(
InvocationContext
context
)
throws
MissingParametersException
{
public
Mono
<
String
>
invoke
(
InvocationContext
context
)
{
return
Mono
.
fromCallable
(()
->
{
invocations
.
incrementAndGet
();
return
"test"
;
...
...
@@ -235,7 +234,7 @@ class CachingOperationInvokerTests {
static
AtomicInteger
invocations
=
new
AtomicInteger
();
@Override
public
Flux
<
String
>
invoke
(
InvocationContext
context
)
throws
MissingParametersException
{
public
Flux
<
String
>
invoke
(
InvocationContext
context
)
{
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");
* you may not use this file except in compliance with the License.
...
...
@@ -32,7 +32,6 @@ import org.junit.jupiter.api.extension.BeforeEachCallback;
import
org.junit.jupiter.api.extension.Extension
;
import
org.junit.jupiter.api.extension.ExtensionContext
;
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.TestTemplateInvocationContext
;
import
org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider
;
...
...
@@ -161,15 +160,13 @@ class WebEndpointTestInvocationContextProvider implements TestTemplateInvocation
}
@Override
public
boolean
supportsParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
throws
ParameterResolutionException
{
public
boolean
supportsParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
{
Class
<?>
type
=
parameterContext
.
getParameter
().
getType
();
return
type
.
equals
(
WebTestClient
.
class
)
||
type
.
isAssignableFrom
(
ConfigurableApplicationContext
.
class
);
}
@Override
public
Object
resolveParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
throws
ParameterResolutionException
{
public
Object
resolveParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
{
Class
<?>
type
=
parameterContext
.
getParameter
().
getType
();
if
(
type
.
equals
(
WebTestClient
.
class
))
{
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");
* you may not use this file except in compliance with the License.
...
...
@@ -36,7 +36,7 @@ class HeapDumpWebEndpointTests {
HeapDumpWebEndpoint
slowEndpoint
=
new
HeapDumpWebEndpoint
(
2500
)
{
@Override
protected
HeapDumper
createHeapDumper
()
throws
HeapDumperUnavailableException
{
protected
HeapDumper
createHeapDumper
()
{
return
(
file
,
live
)
->
{
dumpingLatch
.
countDown
();
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");
* you may not use this file except in compliance with the License.
...
...
@@ -25,7 +25,6 @@ import java.util.Set;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.BeanFactory
;
import
org.springframework.beans.factory.BeanFactoryAware
;
import
org.springframework.beans.factory.config.ConfigurableListableBeanFactory
;
...
...
@@ -260,7 +259,7 @@ class AutoConfigurationImportSelectorTests {
}
@Override
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
throws
BeansException
{
public
void
setBeanFactory
(
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");
* you may not use this file except in compliance with the License.
...
...
@@ -21,7 +21,6 @@ import java.util.List;
import
org.junit.jupiter.api.Test
;
import
org.mockito.ArgumentCaptor
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.config.BeanDefinition
;
import
org.springframework.beans.factory.config.ConfigurableListableBeanFactory
;
import
org.springframework.beans.factory.support.AbstractBeanDefinition
;
...
...
@@ -106,11 +105,11 @@ class SharedMetadataReaderFactoryContextInitializerTests {
static
class
PostProcessor
implements
BeanDefinitionRegistryPostProcessor
{
@Override
public
void
postProcessBeanFactory
(
ConfigurableListableBeanFactory
beanFactory
)
throws
BeansException
{
public
void
postProcessBeanFactory
(
ConfigurableListableBeanFactory
beanFactory
)
{
}
@Override
public
void
postProcessBeanDefinitionRegistry
(
BeanDefinitionRegistry
registry
)
throws
BeansException
{
public
void
postProcessBeanDefinitionRegistry
(
BeanDefinitionRegistry
registry
)
{
for
(
String
name
:
registry
.
getBeanDefinitionNames
())
{
BeanDefinition
definition
=
registry
.
getBeanDefinition
(
name
);
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");
* you may not use this file except in compliance with the License.
...
...
@@ -127,8 +127,7 @@ public class MockCachingProvider implements CachingProvider {
@Override
@SuppressWarnings
(
"unchecked"
)
public
<
K
,
V
,
C
extends
Configuration
<
K
,
V
>>
Cache
<
K
,
V
>
createCache
(
String
cacheName
,
C
configuration
)
throws
IllegalArgumentException
{
public
<
K
,
V
,
C
extends
Configuration
<
K
,
V
>>
Cache
<
K
,
V
>
createCache
(
String
cacheName
,
C
configuration
)
{
this
.
configurations
.
put
(
cacheName
,
configuration
);
Cache
<
K
,
V
>
cache
=
mock
(
Cache
.
class
);
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;
import
org.testcontainers.junit.jupiter.Container
;
import
org.testcontainers.junit.jupiter.Testcontainers
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.beans.factory.support.BeanDefinitionRegistry
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
...
...
@@ -78,7 +77,7 @@ class CassandraAutoConfigurationIntegrationTests {
return
new
BeanPostProcessor
()
{
@Override
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
{
if
(
bean
instanceof
DriverConfigLoader
)
{
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");
* you may not use this file except in compliance with the License.
...
...
@@ -27,7 +27,6 @@ import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import
org.springframework.boot.test.context.runner.ContextConsumer
;
import
org.springframework.context.MessageSource
;
import
org.springframework.context.MessageSourceResolvable
;
import
org.springframework.context.NoSuchMessageException
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.PropertySource
;
...
...
@@ -223,12 +222,12 @@ class MessageSourceAutoConfigurationTests {
}
@Override
public
String
getMessage
(
String
code
,
Object
[]
args
,
Locale
locale
)
throws
NoSuchMessageException
{
public
String
getMessage
(
String
code
,
Object
[]
args
,
Locale
locale
)
{
return
code
;
}
@Override
public
String
getMessage
(
MessageSourceResolvable
resolvable
,
Locale
locale
)
throws
NoSuchMessageException
{
public
String
getMessage
(
MessageSourceResolvable
resolvable
,
Locale
locale
)
{
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");
* you may not use this file except in compliance with the License.
...
...
@@ -18,7 +18,6 @@ package org.springframework.boot.autoconfigure.data.redis;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
import
org.springframework.boot.test.context.runner.ApplicationContextRunner
;
...
...
@@ -233,7 +232,7 @@ class RedisAutoConfigurationJedisTests {
static
JedisConnectionFactory
connectionFactory
;
@Override
public
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
public
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
{
if
(
bean
instanceof
JedisConnectionFactory
)
{
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");
* you may not use this file except in compliance with the License.
...
...
@@ -24,7 +24,6 @@ import javax.sql.DataSource;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.BeanCreationException
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
import
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
;
...
...
@@ -115,7 +114,7 @@ class H2ConsoleAutoConfigurationTests {
@Test
@ExtendWith
(
OutputCaptureExtension
.
class
)
void
dataSourceUrlIsLoggedWhenAvailable
(
CapturedOutput
output
)
throws
BeansException
{
void
dataSourceUrlIsLoggedWhenAvailable
(
CapturedOutput
output
)
{
this
.
contextRunner
.
withConfiguration
(
AutoConfigurations
.
of
(
DataSourceAutoConfiguration
.
class
))
.
withPropertyValues
(
"spring.h2.console.enabled=true"
).
run
((
context
)
->
{
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;
import
com.zaxxer.hikari.HikariDataSource
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.BeanCreationException
;
import
org.springframework.beans.factory.config.BeanFactoryPostProcessor
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
...
...
@@ -348,7 +347,7 @@ class DataSourceInitializationIntegrationTests {
return
new
BeanPostProcessor
()
{
@Override
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
{
if
(
bean
instanceof
DataSource
)
{
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 {
@SuppressWarnings
(
"unchecked"
)
@Test
void
mbeanDataSourceIsExcludedFromExport
()
throws
IllegalStateException
{
void
mbeanDataSourceIsExcludedFromExport
()
{
DataSource
dataSource
=
new
BasicDataSource
();
configureJndi
(
"foo"
,
dataSource
);
...
...
@@ -110,7 +110,7 @@ class JndiDataSourceAutoConfigurationTests {
@SuppressWarnings
(
"unchecked"
)
@Test
void
mbeanDataSourceIsExcludedFromExportByAllExporters
()
throws
IllegalStateException
{
void
mbeanDataSourceIsExcludedFromExportByAllExporters
()
{
DataSource
dataSource
=
new
BasicDataSource
();
configureJndi
(
"foo"
,
dataSource
);
this
.
context
=
new
AnnotationConfigApplicationContext
();
...
...
@@ -127,7 +127,7 @@ class JndiDataSourceAutoConfigurationTests {
@SuppressWarnings
(
"unchecked"
)
@Test
void
standardDataSourceIsNotExcludedFromExport
()
throws
IllegalStateException
{
void
standardDataSourceIsNotExcludedFromExport
()
{
DataSource
dataSource
=
mock
(
DataSource
.
class
);
configureJndi
(
"foo"
,
dataSource
);
...
...
@@ -142,7 +142,7 @@ class JndiDataSourceAutoConfigurationTests {
assertThat
(
excludedBeans
).
isEmpty
();
}
private
void
configureJndi
(
String
name
,
DataSource
dataSource
)
throws
IllegalStateException
{
private
void
configureJndi
(
String
name
,
DataSource
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;
import
org.junit.jupiter.api.Test
;
import
org.messaginghub.pooled.jms.JmsPoolConnectionFactory
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
import
org.springframework.boot.autoconfigure.jms.activemq.ActiveMQAutoConfiguration
;
...
...
@@ -440,7 +439,7 @@ class JmsAutoConfigurationTests {
static
class
TestConfiguration4
implements
BeanPostProcessor
{
@Override
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
{
if
(
bean
.
getClass
().
isAssignableFrom
(
JmsTemplate
.
class
))
{
JmsTemplate
jmsTemplate
=
(
JmsTemplate
)
bean
;
jmsTemplate
.
setPubSubDomain
(
true
);
...
...
@@ -449,7 +448,7 @@ class JmsAutoConfigurationTests {
}
@Override
public
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
public
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
{
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");
* you may not use this file except in compliance with the License.
...
...
@@ -238,7 +238,7 @@ class MailSenderAutoConfigurationTests {
});
}
private
Session
configureJndiSession
(
String
name
)
throws
IllegalStateException
{
private
Session
configureJndiSession
(
String
name
)
{
Properties
properties
=
new
Properties
();
Session
session
=
Session
.
getDefaultInstance
(
properties
);
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;
import
org.junit.jupiter.api.Test
;
import
reactor.core.publisher.Flux
;
import
org.springframework.beans.BeansException
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
import
org.springframework.boot.autoconfigure.security.reactive.ReactiveSecurityAutoConfiguration
;
import
org.springframework.boot.test.context.FilteredClassLoader
;
...
...
@@ -253,7 +252,7 @@ class ReactiveOAuth2ClientAutoConfigurationTests {
static
class
TestServerHttpSecurity
extends
ServerHttpSecurity
implements
ApplicationContextAware
{
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
public
void
setApplicationContext
(
ApplicationContext
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");
* you may not use this file except in compliance with the License.
...
...
@@ -21,7 +21,6 @@ import java.util.Map;
import
org.springframework.boot.web.reactive.server.AbstractReactiveWebServerFactory
;
import
org.springframework.boot.web.reactive.server.ReactiveWebServerFactory
;
import
org.springframework.boot.web.server.WebServer
;
import
org.springframework.boot.web.server.WebServerException
;
import
org.springframework.http.server.reactive.HttpHandler
;
import
static
org
.
mockito
.
Mockito
.
spy
;
...
...
@@ -72,12 +71,12 @@ public class MockReactiveWebServerFactory extends AbstractReactiveWebServerFacto
}
@Override
public
void
start
()
throws
WebServerException
{
public
void
start
()
{
}
@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");
* you may not use this file except in compliance with the License.
...
...
@@ -29,7 +29,6 @@ import org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.event.ContextRefreshedEvent
;
import
org.springframework.util.unit.DataSize
;
import
org.springframework.web.multipart.MultipartException
;
import
org.springframework.web.multipart.MultipartHttpServletRequest
;
import
org.springframework.web.multipart.MultipartResolver
;
import
org.springframework.web.servlet.DispatcherServlet
;
...
...
@@ -273,7 +272,7 @@ class DispatcherServletAutoConfigurationTests {
}
@Override
public
MultipartHttpServletRequest
resolveMultipart
(
HttpServletRequest
request
)
throws
MultipartException
{
public
MultipartHttpServletRequest
resolveMultipart
(
HttpServletRequest
request
)
{
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");
* you may not use this file except in compliance with the License.
...
...
@@ -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.RegisteredServlet
;
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.server.AbstractServletWebServerFactory
;
import
org.springframework.boot.web.servlet.server.ServletWebServerFactory
;
...
...
@@ -71,7 +70,7 @@ public class MockServletWebServerFactory extends AbstractServletWebServerFactory
}
@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");
* you may not use this file except in compliance with the License.
...
...
@@ -31,7 +31,6 @@ import org.eclipse.jetty.server.Server;
import
org.junit.jupiter.api.Test
;
import
reactor.netty.http.server.HttpServer
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.boot.autoconfigure.AutoConfigurations
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
;
...
...
@@ -455,7 +454,7 @@ class ServletWebServerFactoryAutoConfigurationTests {
static
class
EnsureWebServerHasNoServletContext
implements
BeanPostProcessor
{
@Override
public
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
public
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
{
if
(
bean
instanceof
ConfigurableServletWebServerFactory
)
{
MockServletWebServerFactory
webServerFactory
=
(
MockServletWebServerFactory
)
bean
;
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");
* you may not use this file except in compliance with the License.
...
...
@@ -27,7 +27,6 @@ import javax.sql.DataSource;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.annotation.AnnotatedGenericBeanDefinition
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.boot.test.util.TestPropertyValues
;
...
...
@@ -161,7 +160,7 @@ abstract class AbstractDevToolsDataSourceAutoConfigurationTests {
static
class
DataSourceSpyBeanPostProcessor
implements
BeanPostProcessor
{
@Override
public
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
public
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
{
if
(
bean
instanceof
DataSource
)
{
bean
=
spy
(
bean
);
}
...
...
@@ -169,7 +168,7 @@ abstract class AbstractDevToolsDataSourceAutoConfigurationTests {
}
@Override
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
{
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");
* you may not use this file except in compliance with the License.
...
...
@@ -24,7 +24,6 @@ import org.junit.jupiter.api.extension.AfterEachCallback;
import
org.junit.jupiter.api.extension.BeforeEachCallback
;
import
org.junit.jupiter.api.extension.ExtensionContext
;
import
org.junit.jupiter.api.extension.ParameterContext
;
import
org.junit.jupiter.api.extension.ParameterResolutionException
;
import
org.junit.jupiter.api.extension.ParameterResolver
;
import
org.springframework.beans.factory.ObjectFactory
;
...
...
@@ -73,14 +72,12 @@ public class MockRestarter implements BeforeEachCallback, AfterEachCallback, Par
}
@Override
public
boolean
supportsParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
throws
ParameterResolutionException
{
public
boolean
supportsParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
{
return
parameterContext
.
getParameter
().
getType
().
equals
(
Restarter
.
class
);
}
@Override
public
Object
resolveParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
throws
ParameterResolutionException
{
public
Object
resolveParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
{
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");
* you may not use this file except in compliance with the License.
...
...
@@ -19,7 +19,6 @@ package org.springframework.boot.test.mock.mockito;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.mock.mockito.MockBeanOnContextHierarchyIntegrationTests.ChildConfig
;
import
org.springframework.boot.test.mock.mockito.MockBeanOnContextHierarchyIntegrationTests.ParentConfig
;
...
...
@@ -73,7 +72,7 @@ class MockBeanOnContextHierarchyIntegrationTests {
private
ApplicationContext
context
;
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
public
void
setApplicationContext
(
ApplicationContext
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");
* you may not use this file except in compliance with the License.
...
...
@@ -22,7 +22,6 @@ import org.junit.jupiter.api.Test;
import
org.mockito.Mockito
;
import
org.springframework.beans.BeanWrapper
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.FactoryBean
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.config.BeanFactoryPostProcessor
;
...
...
@@ -309,7 +308,7 @@ class MockitoPostProcessorTests {
static
class
FactoryBeanRegisteringPostProcessor
implements
BeanFactoryPostProcessor
,
Ordered
{
@Override
public
void
postProcessBeanFactory
(
ConfigurableListableBeanFactory
beanFactory
)
throws
BeansException
{
public
void
postProcessBeanFactory
(
ConfigurableListableBeanFactory
beanFactory
)
{
RootBeanDefinition
beanDefinition
=
new
RootBeanDefinition
(
TestFactoryBean
.
class
);
((
BeanDefinitionRegistry
)
beanFactory
).
registerBeanDefinition
(
"test"
,
beanDefinition
);
}
...
...
@@ -325,7 +324,7 @@ class MockitoPostProcessorTests {
@Override
@SuppressWarnings
(
"unchecked"
)
public
void
postProcessBeanFactory
(
ConfigurableListableBeanFactory
beanFactory
)
throws
BeansException
{
public
void
postProcessBeanFactory
(
ConfigurableListableBeanFactory
beanFactory
)
{
Map
<
String
,
BeanWrapper
>
cache
=
(
Map
<
String
,
BeanWrapper
>)
ReflectionTestUtils
.
getField
(
beanFactory
,
"factoryBeanInstanceCache"
);
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");
* you may not use this file except in compliance with the License.
...
...
@@ -19,7 +19,6 @@ package org.springframework.boot.test.mock.mockito;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.mock.mockito.SpyBeanOnContextHierarchyIntegrationTests.ChildConfig
;
import
org.springframework.boot.test.mock.mockito.SpyBeanOnContextHierarchyIntegrationTests.ParentConfig
;
...
...
@@ -74,7 +73,7 @@ class SpyBeanOnContextHierarchyIntegrationTests {
private
ApplicationContext
context
;
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
public
void
setApplicationContext
(
ApplicationContext
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");
* you may not use this file except in compliance with the License.
...
...
@@ -16,7 +16,6 @@
package
org
.
springframework
.
boot
.
test
.
web
.
client
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.BeanFactory
;
import
org.springframework.beans.factory.BeanFactoryAware
;
import
org.springframework.beans.factory.BeanFactoryUtils
;
...
...
@@ -33,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class
NoTestRestTemplateBeanChecker
implements
ImportSelector
,
BeanFactoryAware
{
@Override
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
throws
BeansException
{
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
{
assertThat
(
BeanFactoryUtils
.
beanNamesForTypeIncludingAncestors
((
ListableBeanFactory
)
beanFactory
,
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");
* you may not use this file except in compliance with the License.
...
...
@@ -18,7 +18,6 @@ package org.springframework.boot.test.web.client;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.config.ConfigurableListableBeanFactory
;
import
org.springframework.beans.factory.support.DefaultListableBeanFactory
;
import
org.springframework.boot.test.context.SpringBootTest
;
...
...
@@ -58,7 +57,7 @@ class TestRestTemplateContextCustomizerTests {
private
final
ConfigurableListableBeanFactory
beanFactory
=
new
DefaultListableBeanFactory
();
@Override
protected
void
refreshBeanFactory
()
throws
BeansException
,
IllegalStateException
{
protected
void
refreshBeanFactory
()
{
}
@Override
...
...
@@ -67,7 +66,7 @@ class TestRestTemplateContextCustomizerTests {
}
@Override
public
ConfigurableListableBeanFactory
getBeanFactory
()
throws
IllegalStateException
{
public
ConfigurableListableBeanFactory
getBeanFactory
()
{
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 {
ReflectionUtils
.
doWithMethods
(
RestOperations
.
class
,
new
MethodCallback
()
{
@Override
public
void
doWith
(
Method
method
)
throws
IllegalArgumentException
{
public
void
doWith
(
Method
method
)
{
Method
equivalent
=
ReflectionUtils
.
findMethod
(
TestRestTemplate
.
class
,
method
.
getName
(),
method
.
getParameterTypes
());
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");
* you may not use this file except in compliance with the License.
...
...
@@ -16,7 +16,6 @@
package
org
.
springframework
.
boot
.
test
.
web
.
reactive
.
server
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.BeanFactory
;
import
org.springframework.beans.factory.BeanFactoryAware
;
import
org.springframework.beans.factory.BeanFactoryUtils
;
...
...
@@ -34,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class
NoWebTestClientBeanChecker
implements
ImportSelector
,
BeanFactoryAware
{
@Override
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
throws
BeansException
{
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
{
assertThat
(
BeanFactoryUtils
.
beanNamesForTypeIncludingAncestors
((
ListableBeanFactory
)
beanFactory
,
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;
import
java.time.Instant
;
import
java.util.Properties
;
import
org.gradle.testkit.runner.InvalidRunnerConfigurationException
;
import
org.gradle.testkit.runner.TaskOutcome
;
import
org.gradle.testkit.runner.UnexpectedBuildFailure
;
import
org.junit.jupiter.api.TestTemplate
;
import
org.springframework.boot.gradle.junit.GradleCompatibility
;
...
...
@@ -111,8 +109,7 @@ class BuildInfoIntegrationTests {
}
@TestTemplate
void
reproducibleOutputWithFixedTime
()
throws
InvalidRunnerConfigurationException
,
UnexpectedBuildFailure
,
IOException
,
InterruptedException
{
void
reproducibleOutputWithFixedTime
()
throws
IOException
,
InterruptedException
{
assertThat
(
this
.
gradleBuild
.
build
(
"buildInfo"
,
"-PnullTime"
).
task
(
":buildInfo"
).
getOutcome
())
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
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;
import
java.util.zip.ZipEntry
;
import
org.gradle.testkit.runner.BuildResult
;
import
org.gradle.testkit.runner.InvalidRunnerConfigurationException
;
import
org.gradle.testkit.runner.TaskOutcome
;
import
org.gradle.testkit.runner.UnexpectedBuildFailure
;
import
org.junit.jupiter.api.TestTemplate
;
import
org.springframework.boot.gradle.testkit.GradleBuild
;
...
...
@@ -92,8 +90,7 @@ abstract class AbstractBootArchiveIntegrationTests {
}
@TestTemplate
void
reproducibleArchive
()
throws
InvalidRunnerConfigurationException
,
UnexpectedBuildFailure
,
IOException
,
InterruptedException
{
void
reproducibleArchive
()
throws
IOException
,
InterruptedException
{
assertThat
(
this
.
gradleBuild
.
build
(
this
.
taskName
).
task
(
":"
+
this
.
taskName
).
getOutcome
())
.
isEqualTo
(
TaskOutcome
.
SUCCESS
);
File
jar
=
new
File
(
this
.
gradleBuild
.
getProjectDir
(),
"build/libs"
).
listFiles
()[
0
];
...
...
@@ -229,8 +226,7 @@ abstract class AbstractBootArchiveIntegrationTests {
}
@TestTemplate
void
upToDateWhenBuiltWithDefaultLayeredAndThenWithExplicitLayered
()
throws
InvalidRunnerConfigurationException
,
UnexpectedBuildFailure
{
void
upToDateWhenBuiltWithDefaultLayeredAndThenWithExplicitLayered
()
{
assertThat
(
this
.
gradleBuild
.
scriptProperty
(
"layered"
,
""
).
build
(
""
+
this
.
taskName
).
task
(
":"
+
this
.
taskName
)
.
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
this
.
gradleBuild
.
scriptProperty
(
"layered"
,
"layered {}"
).
build
(
""
+
this
.
taskName
)
...
...
@@ -238,8 +234,7 @@ abstract class AbstractBootArchiveIntegrationTests {
}
@TestTemplate
void
notUpToDateWhenBuiltWithoutLayersAndThenWithLayers
()
throws
InvalidRunnerConfigurationException
,
UnexpectedBuildFailure
{
void
notUpToDateWhenBuiltWithoutLayersAndThenWithLayers
()
{
assertThat
(
this
.
gradleBuild
.
scriptProperty
(
"layerEnablement"
,
"enabled = false"
).
build
(
this
.
taskName
)
.
task
(
":"
+
this
.
taskName
).
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
assertThat
(
this
.
gradleBuild
.
scriptProperty
(
"layerEnablement"
,
"enabled = true"
).
build
(
this
.
taskName
)
...
...
@@ -247,8 +242,7 @@ abstract class AbstractBootArchiveIntegrationTests {
}
@TestTemplate
void
notUpToDateWhenBuiltWithLayerToolsAndThenWithoutLayerTools
()
throws
InvalidRunnerConfigurationException
,
UnexpectedBuildFailure
{
void
notUpToDateWhenBuiltWithLayerToolsAndThenWithoutLayerTools
()
{
assertThat
(
this
.
gradleBuild
.
scriptProperty
(
"layerTools"
,
""
).
build
(
this
.
taskName
).
task
(
":"
+
this
.
taskName
)
.
getOutcome
()).
isEqualTo
(
TaskOutcome
.
SUCCESS
);
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");
* you may not use this file except in compliance with the License.
...
...
@@ -27,7 +27,6 @@ import java.util.stream.Stream;
import
org.junit.jupiter.api.extension.Extension
;
import
org.junit.jupiter.api.extension.ExtensionContext
;
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.TestTemplateInvocationContext
;
import
org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider
;
...
...
@@ -84,14 +83,12 @@ class MavenBuildExtension implements TestTemplateInvocationContextProvider {
}
@Override
public
boolean
supportsParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
throws
ParameterResolutionException
{
public
boolean
supportsParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
{
return
parameterContext
.
getParameter
().
getType
().
equals
(
MavenBuild
.
class
);
}
@Override
public
Object
resolveParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
throws
ParameterResolutionException
{
public
Object
resolveParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
{
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;
import
org.mockito.Mockito
;
import
reactor.core.publisher.Mono
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.CachedIntrospectionResults
;
import
org.springframework.beans.factory.BeanCreationException
;
import
org.springframework.beans.factory.config.ConfigurableListableBeanFactory
;
...
...
@@ -1659,7 +1658,7 @@ class SpringApplicationTests {
}
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
public
void
setApplicationContext
(
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
}
@Override
public
List
<
Resource
>
resolve
(
ConfigDataLocationResolverContext
context
,
ConfigDataLocation
location
)
throws
ConfigDataLocationNotFoundException
,
ConfigDataResourceNotFoundException
{
public
List
<
Resource
>
resolve
(
ConfigDataLocationResolverContext
context
,
ConfigDataLocation
location
)
{
return
Collections
.
emptyList
();
}
@Override
public
List
<
Resource
>
resolveProfileSpecific
(
ConfigDataLocationResolverContext
context
,
ConfigDataLocation
location
,
Profiles
profiles
)
throws
ConfigDataLocationNotFoundException
{
ConfigDataLocation
location
,
Profiles
profiles
)
{
return
Collections
.
singletonList
(
new
Resource
(
profiles
));
}
...
...
@@ -98,8 +97,7 @@ class ConfigDataEnvironmentPostProcessorImportCombinedWithProfileSpecificIntegra
static
class
Loader
implements
ConfigDataLoader
<
Resource
>
{
@Override
public
ConfigData
load
(
ConfigDataLoaderContext
context
,
Resource
resource
)
throws
IOException
,
ConfigDataResourceNotFoundException
{
public
ConfigData
load
(
ConfigDataLoaderContext
context
,
Resource
resource
)
throws
IOException
{
List
<
PropertySource
<?>>
propertySources
=
new
ArrayList
<>();
Map
<
PropertySource
<?>,
Options
>
propertySourceOptions
=
new
HashMap
<>();
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 {
@Override
public
List
<
TestConfigDataResource
>
resolve
(
ConfigDataLocationResolverContext
context
,
ConfigDataLocation
location
)
throws
ConfigDataLocationNotFoundException
,
ConfigDataResourceNotFoundException
{
ConfigDataLocation
location
)
{
return
Collections
.
singletonList
(
new
TestConfigDataResource
(
this
,
location
,
false
));
}
@Override
public
List
<
TestConfigDataResource
>
resolveProfileSpecific
(
ConfigDataLocationResolverContext
context
,
ConfigDataLocation
location
,
Profiles
profiles
)
throws
ConfigDataLocationNotFoundException
{
ConfigDataLocation
location
,
Profiles
profiles
)
{
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 {
private
CapturedOutput
output
;
@BeforeEach
void
init
(
CapturedOutput
output
)
throws
SecurityException
,
IOException
{
void
init
(
CapturedOutput
output
)
throws
IOException
{
this
.
systemPropertyNames
=
new
HashSet
<>(
System
.
getProperties
().
keySet
());
this
.
output
=
output
;
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;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.BeanCreationException
;
import
org.springframework.beans.factory.FactoryBean
;
import
org.springframework.beans.factory.InitializingBean
;
...
...
@@ -382,7 +381,7 @@ class ConfigurationPropertiesTests {
this
.
context
=
new
AnnotationConfigApplicationContext
()
{
@Override
protected
void
onRefresh
()
throws
BeansException
{
protected
void
onRefresh
()
{
assertThat
(
WithFactoryBeanConfiguration
.
factoryBeanInitialized
).
as
(
"Initialized too early"
).
isFalse
();
super
.
onRefresh
();
}
...
...
@@ -2298,7 +2297,7 @@ class ConfigurationPropertiesTests {
static
class
PersonPropertyEditor
extends
PropertyEditorSupport
{
@Override
public
void
setAsText
(
String
text
)
throws
IllegalArgumentException
{
public
void
setAsText
(
String
text
)
{
String
[]
content
=
text
.
split
(
","
);
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 {
static
class
SampleTypePropertyEditor
extends
PropertyEditorSupport
{
@Override
public
void
setAsText
(
String
text
)
throws
IllegalArgumentException
{
public
void
setAsText
(
String
text
)
{
SampleType
value
=
new
SampleType
();
value
.
text
=
text
;
setValue
(
value
);
...
...
@@ -238,7 +238,7 @@ class BindConverterTests {
static
class
ConventionTypeEditor
extends
PropertyEditorSupport
{
@Override
public
void
setAsText
(
String
text
)
throws
IllegalArgumentException
{
public
void
setAsText
(
String
text
)
{
ConventionType
value
=
new
ConventionType
();
value
.
text
=
text
;
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 {
static
class
JavaBeanPropertyEditor
extends
PropertyEditorSupport
{
@Override
public
void
setAsText
(
String
text
)
throws
IllegalArgumentException
{
public
void
setAsText
(
String
text
)
{
JavaBean
value
=
new
JavaBean
();
value
.
setValue
(
text
);
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");
* you may not use this file except in compliance with the License.
...
...
@@ -23,7 +23,6 @@ import java.util.Enumeration;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.BeanFactory
;
import
org.springframework.beans.factory.BeanFactoryAware
;
import
org.springframework.context.EnvironmentAware
;
...
...
@@ -146,7 +145,7 @@ class FailureAnalyzersTests {
}
@Override
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
throws
BeansException
{
public
void
setBeanFactory
(
BeanFactory
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");
* you may not use this file except in compliance with the License.
...
...
@@ -61,7 +61,7 @@ class JavaLoggingSystemTests extends AbstractLoggingSystemTests {
private
Locale
defaultLocale
;
@BeforeEach
void
init
()
throws
SecurityException
{
void
init
()
{
this
.
logger
=
Logger
.
getLogger
(
getClass
().
getName
());
this
.
defaultLocale
=
Locale
.
getDefault
();
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");
* you may not use this file except in compliance with the License.
...
...
@@ -19,7 +19,6 @@ package org.springframework.boot.web.reactive.server;
import
java.util.Map
;
import
org.springframework.boot.web.server.WebServer
;
import
org.springframework.boot.web.server.WebServerException
;
import
org.springframework.http.server.reactive.HttpHandler
;
import
static
org
.
mockito
.
Mockito
.
spy
;
...
...
@@ -70,12 +69,12 @@ public class MockReactiveWebServerFactory extends AbstractReactiveWebServerFacto
}
@Override
public
void
start
()
throws
WebServerException
{
public
void
start
()
{
}
@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");
* you may not use this file except in compliance with the License.
...
...
@@ -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.RegisteredServlet
;
import
org.springframework.boot.web.server.WebServer
;
import
org.springframework.boot.web.server.WebServerException
;
import
org.springframework.boot.web.servlet.ServletContextInitializer
;
import
static
org
.
mockito
.
Mockito
.
spy
;
...
...
@@ -69,7 +68,7 @@ public class MockServletWebServerFactory extends AbstractServletWebServerFactory
}
@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;
import
org.junit.jupiter.api.extension.Extension
;
import
org.junit.jupiter.api.extension.ExtensionContext
;
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.TestTemplateInvocationContext
;
import
org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider
;
...
...
@@ -150,8 +149,7 @@ class EmbeddedServerContainerInvocationContextProvider
}
@Override
public
boolean
supportsParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
throws
ParameterResolutionException
{
public
boolean
supportsParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
{
if
(
parameterContext
.
getParameter
().
getType
().
equals
(
AbstractApplicationLauncher
.
class
))
{
return
true
;
}
...
...
@@ -162,8 +160,7 @@ class EmbeddedServerContainerInvocationContextProvider
}
@Override
public
Object
resolveParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
throws
ParameterResolutionException
{
public
Object
resolveParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
{
if
(
parameterContext
.
getParameter
().
getType
().
equals
(
AbstractApplicationLauncher
.
class
))
{
return
this
.
launcher
;
}
...
...
@@ -181,14 +178,12 @@ class EmbeddedServerContainerInvocationContextProvider
}
@Override
public
boolean
supportsParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
throws
ParameterResolutionException
{
public
boolean
supportsParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
{
return
parameterContext
.
getParameter
().
getType
().
equals
(
RestTemplate
.
class
);
}
@Override
public
Object
resolveParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
throws
ParameterResolutionException
{
public
Object
resolveParameter
(
ParameterContext
parameterContext
,
ExtensionContext
extensionContext
)
{
RestTemplate
rest
=
new
RestTemplate
(
new
HttpComponentsClientHttpRequestFactory
(
HttpClients
.
custom
().
setRetryHandler
(
new
StandardHttpRequestRetryHandler
(
10
,
false
)).
build
()));
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