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
2b426c30
Commit
2b426c30
authored
Oct 24, 2017
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish “Remove explicit type arguments”
Closes gh-10494
parent
6168fae7
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
65 additions
and
86 deletions
+65
-86
RequestMappingEndpointTests.java
...utoconfigure/web/servlet/RequestMappingEndpointTests.java
+2
-4
ShutdownEndpoint.java
...pringframework/boot/actuate/context/ShutdownEndpoint.java
+4
-4
AuditListenerTests.java
...ework/boot/actuate/audit/listener/AuditListenerTests.java
+1
-2
AuthorizationAuditListenerTests.java
...oot/actuate/security/AuthorizationAuditListenerTests.java
+3
-6
HttpMessageConverters.java
...mework/boot/autoconfigure/http/HttpMessageConverters.java
+1
-2
HttpMessageConvertersAutoConfiguration.java
...onfigure/http/HttpMessageConvertersAutoConfiguration.java
+2
-2
LdapAutoConfiguration.java
...mework/boot/autoconfigure/ldap/LdapAutoConfiguration.java
+2
-2
EmbeddedMongoAutoConfiguration.java
...figure/mongo/embedded/EmbeddedMongoAutoConfiguration.java
+1
-2
BasicErrorController.java
...autoconfigure/web/servlet/error/BasicErrorController.java
+1
-2
AutoConfigurationImportSelectorTests.java
...t/autoconfigure/AutoConfigurationImportSelectorTests.java
+1
-2
CacheAutoConfigurationTests.java
...boot/autoconfigure/cache/CacheAutoConfigurationTests.java
+1
-2
HazelcastJpaDependencyAutoConfigurationTests.java
...zelcast/HazelcastJpaDependencyAutoConfigurationTests.java
+1
-2
ActiveMQPropertiesTests.java
...t/autoconfigure/jms/activemq/ActiveMQPropertiesTests.java
+1
-2
ProjectGenerationRequestTests.java
.../boot/cli/command/init/ProjectGenerationRequestTests.java
+1
-2
DevToolPropertiesIntegrationTests.java
.../boot/devtools/env/DevToolPropertiesIntegrationTests.java
+2
-2
ItemHint.java
...mework/boot/configurationprocessor/metadata/ItemHint.java
+1
-2
ConfigurationMetadataAnnotationProcessorTests.java
...cessor/ConfigurationMetadataAnnotationProcessorTests.java
+8
-7
JsonMarshallerTests.java
.../configurationprocessor/metadata/JsonMarshallerTests.java
+2
-3
ResourceBanner.java
...rc/main/java/org/springframework/boot/ResourceBanner.java
+2
-2
CompositeDataSourcePoolMetadataProvider.java
...dbc/metadata/CompositeDataSourcePoolMetadataProvider.java
+1
-2
RestTemplateBuilder.java
.../springframework/boot/web/client/RestTemplateBuilder.java
+2
-4
ConfigFileApplicationListenerTests.java
...ot/context/config/ConfigFileApplicationListenerTests.java
+1
-2
ConfigurationPropertySourcesTests.java
.../properties/source/ConfigurationPropertySourcesTests.java
+8
-8
SpringConfigurationPropertySourcesTests.java
...rties/source/SpringConfigurationPropertySourcesTests.java
+14
-14
RestTemplateBuilderTests.java
...ngframework/boot/web/client/RestTemplateBuilderTests.java
+2
-4
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/RequestMappingEndpointTests.java
View file @
2b426c30
...
...
@@ -58,8 +58,7 @@ public class RequestMappingEndpointTests {
mapping
.
setUrlMap
(
Collections
.
singletonMap
(
"/foo"
,
new
Object
()));
mapping
.
setApplicationContext
(
new
StaticApplicationContext
());
mapping
.
initApplicationContext
();
this
.
endpoint
.
setHandlerMappings
(
Collections
.
singletonList
(
mapping
));
this
.
endpoint
.
setHandlerMappings
(
Collections
.
singletonList
(
mapping
));
Map
<
String
,
Object
>
result
=
this
.
endpoint
.
mappings
();
assertThat
(
result
).
hasSize
(
1
);
@SuppressWarnings
(
"unchecked"
)
...
...
@@ -119,8 +118,7 @@ public class RequestMappingEndpointTests {
@Test
public
void
concreteMethodMappings
()
{
WebMvcEndpointHandlerMapping
mapping
=
createHandlerMapping
();
this
.
endpoint
.
setMethodMappings
(
Collections
.
singletonList
(
mapping
));
this
.
endpoint
.
setMethodMappings
(
Collections
.
singletonList
(
mapping
));
Map
<
String
,
Object
>
result
=
this
.
endpoint
.
mappings
();
assertThat
(
result
).
hasSize
(
2
);
assertThat
(
result
.
keySet
())
...
...
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/context/ShutdownEndpoint.java
View file @
2b426c30
...
...
@@ -39,12 +39,12 @@ import org.springframework.context.ConfigurableApplicationContext;
public
class
ShutdownEndpoint
implements
ApplicationContextAware
{
private
static
final
Map
<
String
,
String
>
NO_CONTEXT_MESSAGE
=
Collections
.
unmodifiableMap
(
Collections
.
singletonMap
(
"message"
,
"No context to shutdown."
));
.
unmodifiableMap
(
Collections
.
singletonMap
(
"message"
,
"No context to shutdown."
));
private
static
final
Map
<
String
,
String
>
SHUTDOWN_MESSAGE
=
Collections
.
unmodifiableMap
(
Collections
.
singletonMap
(
"message"
,
"Shutting down, bye..."
));
.
unmodifiableMap
(
Collections
.
singletonMap
(
"message"
,
"Shutting down, bye..."
));
private
ConfigurableApplicationContext
context
;
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/listener/AuditListenerTests.java
View file @
2b426c30
...
...
@@ -36,8 +36,7 @@ public class AuditListenerTests {
@Test
public
void
testStoredEvents
()
{
AuditEventRepository
repository
=
mock
(
AuditEventRepository
.
class
);
AuditEvent
event
=
new
AuditEvent
(
"principal"
,
"type"
,
Collections
.
emptyMap
());
AuditEvent
event
=
new
AuditEvent
(
"principal"
,
"type"
,
Collections
.
emptyMap
());
AuditListener
listener
=
new
AuditListener
(
repository
);
listener
.
onApplicationEvent
(
new
AuditApplicationEvent
(
event
));
verify
(
repository
).
add
(
event
);
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthorizationAuditListenerTests.java
View file @
2b426c30
...
...
@@ -55,8 +55,7 @@ public class AuthorizationAuditListenerTests {
public
void
testAuthenticationCredentialsNotFound
()
{
AuditApplicationEvent
event
=
handleAuthorizationEvent
(
new
AuthenticationCredentialsNotFoundEvent
(
this
,
Collections
.
singletonList
(
new
SecurityConfig
(
"USER"
)),
Collections
.
singletonList
(
new
SecurityConfig
(
"USER"
)),
new
AuthenticationCredentialsNotFoundException
(
"Bad user"
)));
assertThat
(
event
.
getAuditEvent
().
getType
())
.
isEqualTo
(
AuthenticationAuditListener
.
AUTHENTICATION_FAILURE
);
...
...
@@ -66,8 +65,7 @@ public class AuthorizationAuditListenerTests {
public
void
testAuthorizationFailure
()
{
AuditApplicationEvent
event
=
handleAuthorizationEvent
(
new
AuthorizationFailureEvent
(
this
,
Collections
.
singletonList
(
new
SecurityConfig
(
"USER"
)),
Collections
.
singletonList
(
new
SecurityConfig
(
"USER"
)),
new
UsernamePasswordAuthenticationToken
(
"user"
,
"password"
),
new
AccessDeniedException
(
"Bad user"
)));
assertThat
(
event
.
getAuditEvent
().
getType
())
...
...
@@ -82,8 +80,7 @@ public class AuthorizationAuditListenerTests {
authentication
.
setDetails
(
details
);
AuditApplicationEvent
event
=
handleAuthorizationEvent
(
new
AuthorizationFailureEvent
(
this
,
Collections
.
singletonList
(
new
SecurityConfig
(
"USER"
)),
Collections
.
singletonList
(
new
SecurityConfig
(
"USER"
)),
authentication
,
new
AccessDeniedException
(
"Bad user"
)));
assertThat
(
event
.
getAuditEvent
().
getType
())
.
isEqualTo
(
AuthorizationAuditListener
.
AUTHORIZATION_FAILURE
);
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/http/HttpMessageConverters.java
View file @
2b426c30
...
...
@@ -103,8 +103,7 @@ public class HttpMessageConverters implements Iterable<HttpMessageConverter<?>>
public
HttpMessageConverters
(
boolean
addDefaultConverters
,
Collection
<
HttpMessageConverter
<?>>
converters
)
{
List
<
HttpMessageConverter
<?>>
combined
=
getCombinedConverters
(
converters
,
addDefaultConverters
?
getDefaultConverters
()
:
Collections
.
emptyList
());
addDefaultConverters
?
getDefaultConverters
()
:
Collections
.
emptyList
());
combined
=
postProcessConverters
(
combined
);
this
.
converters
=
Collections
.
unmodifiableList
(
combined
);
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfiguration.java
View file @
2b426c30
...
...
@@ -68,8 +68,8 @@ public class HttpMessageConvertersAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public
HttpMessageConverters
messageConverters
()
{
return
new
HttpMessageConverters
(
this
.
converters
==
null
?
Collections
.
emptyList
()
:
this
.
converters
);
return
new
HttpMessageConverters
(
this
.
converters
==
null
?
Collections
.
emptyList
()
:
this
.
converters
);
}
@Configuration
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/LdapAutoConfiguration.java
View file @
2b426c30
...
...
@@ -56,8 +56,8 @@ public class LdapAutoConfiguration {
source
.
setPassword
(
this
.
properties
.
getPassword
());
source
.
setBase
(
this
.
properties
.
getBase
());
source
.
setUrls
(
this
.
properties
.
determineUrls
(
this
.
environment
));
source
.
setBaseEnvironmentProperties
(
Collections
.
unmodifiableMap
(
this
.
properties
.
getBaseEnvironment
()));
source
.
setBaseEnvironmentProperties
(
Collections
.
unmodifiableMap
(
this
.
properties
.
getBaseEnvironment
()));
return
source
;
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java
View file @
2b426c30
...
...
@@ -258,8 +258,7 @@ public class EmbeddedMongoAutoConfiguration {
Set
<
Feature
>
features
)
{
Assert
.
notNull
(
version
,
"version must not be null"
);
this
.
version
=
version
;
this
.
features
=
(
features
==
null
?
Collections
.
emptySet
()
:
features
);
this
.
features
=
(
features
==
null
?
Collections
.
emptySet
()
:
features
);
}
@Override
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java
View file @
2b426c30
...
...
@@ -62,8 +62,7 @@ public class BasicErrorController extends AbstractErrorController {
*/
public
BasicErrorController
(
ErrorAttributes
errorAttributes
,
ErrorProperties
errorProperties
)
{
this
(
errorAttributes
,
errorProperties
,
Collections
.
emptyList
());
this
(
errorAttributes
,
errorProperties
,
Collections
.
emptyList
());
}
/**
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelectorTests.java
View file @
2b426c30
...
...
@@ -248,8 +248,7 @@ public class AutoConfigurationImportSelectorTests {
@Override
protected
List
<
AutoConfigurationImportListener
>
getAutoConfigurationImportListeners
()
{
return
Collections
.
singletonList
(
(
event
)
->
this
.
lastEvent
=
event
);
return
Collections
.
singletonList
((
event
)
->
this
.
lastEvent
=
event
);
}
public
AutoConfigurationImportEvent
getLastEvent
()
{
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java
View file @
2b426c30
...
...
@@ -935,8 +935,7 @@ public class CacheAutoConfigurationTests {
@Bean
public
javax
.
cache
.
CacheManager
customJCacheCacheManager
()
{
javax
.
cache
.
CacheManager
cacheManager
=
mock
(
javax
.
cache
.
CacheManager
.
class
);
given
(
cacheManager
.
getCacheNames
())
.
willReturn
(
Collections
.
emptyList
());
given
(
cacheManager
.
getCacheNames
()).
willReturn
(
Collections
.
emptyList
());
return
cacheManager
;
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastJpaDependencyAutoConfigurationTests.java
View file @
2b426c30
...
...
@@ -102,8 +102,7 @@ public class HazelcastJpaDependencyAutoConfigurationTests {
String
[]
dependsOn
=
((
BeanDefinitionRegistry
)
context
.
getSourceApplicationContext
()).
getBeanDefinition
(
"entityManagerFactory"
)
.
getDependsOn
();
return
dependsOn
!=
null
?
Arrays
.
asList
(
dependsOn
)
:
Collections
.
emptyList
();
return
dependsOn
!=
null
?
Arrays
.
asList
(
dependsOn
)
:
Collections
.
emptyList
();
}
@Configuration
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQPropertiesTests.java
View file @
2b426c30
...
...
@@ -87,8 +87,7 @@ public class ActiveMQPropertiesTests {
private
ActiveMQConnectionFactoryFactory
createFactory
(
ActiveMQProperties
properties
)
{
return
new
ActiveMQConnectionFactoryFactory
(
properties
,
Collections
.
emptyList
());
return
new
ActiveMQConnectionFactoryFactory
(
properties
,
Collections
.
emptyList
());
}
}
spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java
View file @
2b426c30
...
...
@@ -43,8 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
public
class
ProjectGenerationRequestTests
{
public
static
final
Map
<
String
,
String
>
EMPTY_TAGS
=
Collections
.
emptyMap
();
public
static
final
Map
<
String
,
String
>
EMPTY_TAGS
=
Collections
.
emptyMap
();
@Rule
public
final
ExpectedException
thrown
=
ExpectedException
.
none
();
...
...
spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/env/DevToolPropertiesIntegrationTests.java
View file @
2b426c30
...
...
@@ -99,8 +99,8 @@ public class DevToolPropertiesIntegrationTests {
SpringApplication
application
=
new
SpringApplication
(
BeanConditionConfiguration
.
class
);
application
.
setWebApplicationType
(
WebApplicationType
.
NONE
);
application
.
setDefaultProperties
(
Collections
.
singletonMap
(
"spring.devtools.remote.secret"
,
"donttell"
));
application
.
setDefaultProperties
(
Collections
.
singletonMap
(
"spring.devtools.remote.secret"
,
"donttell"
));
this
.
context
=
application
.
run
();
this
.
context
.
getBean
(
MyBean
.
class
);
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemHint.java
View file @
2b426c30
...
...
@@ -77,8 +77,7 @@ public class ItemHint implements Comparable<ItemHint> {
}
public
static
ItemHint
newHint
(
String
name
,
ValueHint
...
values
)
{
return
new
ItemHint
(
name
,
Arrays
.
asList
(
values
),
Collections
.
emptyList
());
return
new
ItemHint
(
name
,
Arrays
.
asList
(
values
),
Collections
.
emptyList
());
}
@Override
...
...
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java
View file @
2b426c30
...
...
@@ -818,13 +818,14 @@ public class ConfigurationMetadataAnnotationProcessorTests {
@Test
public
void
mergingOfHintWithProvider
()
throws
Exception
{
writeAdditionalHints
(
new
ItemHint
(
"simple.theName"
,
Collections
.
emptyList
(),
Arrays
.
asList
(
new
ItemHint
.
ValueProvider
(
"first"
,
Collections
.
singletonMap
(
"target"
,
"org.foo"
)),
new
ItemHint
.
ValueProvider
(
"second"
,
null
))));
writeAdditionalHints
(
new
ItemHint
(
"simple.theName"
,
Collections
.
emptyList
(),
Arrays
.
asList
(
new
ItemHint
.
ValueProvider
(
"first"
,
Collections
.
singletonMap
(
"target"
,
"org.foo"
)),
new
ItemHint
.
ValueProvider
(
"second"
,
null
))));
ConfigurationMetadata
metadata
=
compile
(
SimpleProperties
.
class
);
assertThat
(
metadata
).
has
(
Metadata
.
withProperty
(
"simple.the-name"
,
String
.
class
)
.
fromSource
(
SimpleProperties
.
class
)
...
...
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/metadata/JsonMarshallerTests.java
View file @
2b426c30
...
...
@@ -57,9 +57,8 @@ public class JsonMarshallerTests {
metadata
.
add
(
new
ItemHint
(
"d"
,
null
,
Arrays
.
asList
(
new
ItemHint
.
ValueProvider
(
"first"
,
Collections
.
singletonMap
(
"target"
,
"foo"
)),
new
ItemHint
.
ValueProvider
(
"second"
,
null
))));
Collections
.
singletonMap
(
"target"
,
"foo"
)),
new
ItemHint
.
ValueProvider
(
"second"
,
null
))));
ByteArrayOutputStream
outputStream
=
new
ByteArrayOutputStream
();
JsonMarshaller
marshaller
=
new
JsonMarshaller
();
marshaller
.
write
(
metadata
,
outputStream
);
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java
View file @
2b426c30
...
...
@@ -130,8 +130,8 @@ public class ResourceBanner implements Banner {
private
PropertyResolver
getTitleResolver
(
Class
<?>
sourceClass
)
{
MutablePropertySources
sources
=
new
MutablePropertySources
();
String
applicationTitle
=
getApplicationTitle
(
sourceClass
);
Map
<
String
,
Object
>
titleMap
=
Collections
.
singletonMap
(
"application.title"
,
(
applicationTitle
==
null
?
""
:
applicationTitle
));
Map
<
String
,
Object
>
titleMap
=
Collections
.
singletonMap
(
"application.title"
,
(
applicationTitle
==
null
?
""
:
applicationTitle
));
sources
.
addFirst
(
new
MapPropertySource
(
"title"
,
titleMap
));
return
new
PropertySourcesPropertyResolver
(
sources
);
}
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/metadata/CompositeDataSourcePoolMetadataProvider.java
View file @
2b426c30
...
...
@@ -42,8 +42,7 @@ public class CompositeDataSourcePoolMetadataProvider
*/
public
CompositeDataSourcePoolMetadataProvider
(
Collection
<?
extends
DataSourcePoolMetadataProvider
>
providers
)
{
this
.
providers
=
(
providers
==
null
?
Collections
.
emptyList
()
this
.
providers
=
(
providers
==
null
?
Collections
.
emptyList
()
:
Collections
.
unmodifiableList
(
new
ArrayList
<>(
providers
)));
}
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java
View file @
2b426c30
...
...
@@ -596,15 +596,13 @@ public class RestTemplateBuilder {
}
private
<
T
>
Set
<
T
>
append
(
Set
<
T
>
set
,
T
addition
)
{
Set
<
T
>
result
=
new
LinkedHashSet
<>(
set
==
null
?
Collections
.
emptySet
()
:
set
);
Set
<
T
>
result
=
new
LinkedHashSet
<>(
set
==
null
?
Collections
.
emptySet
()
:
set
);
result
.
add
(
addition
);
return
Collections
.
unmodifiableSet
(
result
);
}
private
<
T
>
Set
<
T
>
append
(
Set
<
T
>
set
,
Collection
<?
extends
T
>
additions
)
{
Set
<
T
>
result
=
new
LinkedHashSet
<>(
set
==
null
?
Collections
.
emptySet
()
:
set
);
Set
<
T
>
result
=
new
LinkedHashSet
<>(
set
==
null
?
Collections
.
emptySet
()
:
set
);
result
.
addAll
(
additions
);
return
Collections
.
unmodifiableSet
(
result
);
}
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java
View file @
2b426c30
...
...
@@ -738,8 +738,7 @@ public class ConfigFileApplicationListenerTests {
@Test
public
void
addBeforeDefaultProperties
()
throws
Exception
{
MapPropertySource
defaultSource
=
new
MapPropertySource
(
"defaultProperties"
,
Collections
.
singletonMap
(
"the.property"
,
"fromdefaultproperties"
));
Collections
.
singletonMap
(
"the.property"
,
"fromdefaultproperties"
));
this
.
environment
.
getPropertySources
().
addFirst
(
defaultSource
);
this
.
initializer
.
setSearchNames
(
"testproperties"
);
this
.
initializer
.
postProcessEnvironment
(
this
.
environment
,
this
.
application
);
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertySourcesTests.java
View file @
2b426c30
...
...
@@ -66,8 +66,8 @@ public class ConfigurationPropertySourcesTests {
public
void
getWhenAttachedShouldReturnAttached
()
throws
Exception
{
ConfigurableEnvironment
environment
=
new
StandardEnvironment
();
MutablePropertySources
sources
=
environment
.
getPropertySources
();
sources
.
addFirst
(
new
MapPropertySource
(
"test"
,
Collections
.
singletonMap
(
"a"
,
"b"
)));
sources
.
addFirst
(
new
MapPropertySource
(
"test"
,
Collections
.
singletonMap
(
"a"
,
"b"
)));
int
expectedSize
=
sources
.
size
();
ConfigurationPropertySources
.
attach
(
environment
);
assertThat
(
ConfigurationPropertySources
.
get
(
environment
)).
hasSize
(
expectedSize
);
...
...
@@ -99,10 +99,10 @@ public class ConfigurationPropertySourcesTests {
@Test
public
void
fromPropertySourceShouldFlattenPropertySources
()
throws
Exception
{
StandardEnvironment
environment
=
new
StandardEnvironment
();
environment
.
getPropertySources
().
addFirst
(
new
MapPropertySource
(
"foo"
,
Collections
.
singletonMap
(
"foo"
,
"bar"
)));
environment
.
getPropertySources
().
addFirst
(
new
MapPropertySource
(
"far"
,
Collections
.
singletonMap
(
"far"
,
"far"
)));
environment
.
getPropertySources
().
addFirst
(
new
MapPropertySource
(
"foo"
,
Collections
.
singletonMap
(
"foo"
,
"bar"
)));
environment
.
getPropertySources
().
addFirst
(
new
MapPropertySource
(
"far"
,
Collections
.
singletonMap
(
"far"
,
"far"
)));
MutablePropertySources
sources
=
new
MutablePropertySources
();
sources
.
addFirst
(
new
PropertySource
<
Environment
>(
"env"
,
environment
)
{
...
...
@@ -112,8 +112,8 @@ public class ConfigurationPropertySourcesTests {
}
});
sources
.
addLast
(
new
MapPropertySource
(
"baz"
,
Collections
.
singletonMap
(
"baz"
,
"barf"
)));
sources
.
addLast
(
new
MapPropertySource
(
"baz"
,
Collections
.
singletonMap
(
"baz"
,
"barf"
)));
Iterable
<
ConfigurationPropertySource
>
configurationSources
=
ConfigurationPropertySources
.
from
(
sources
);
assertThat
(
configurationSources
.
iterator
()).
hasSize
(
5
);
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySourcesTests.java
View file @
2b426c30
...
...
@@ -53,8 +53,8 @@ public class SpringConfigurationPropertySourcesTests {
@Test
public
void
shouldAdaptPropertySource
()
throws
Exception
{
MutablePropertySources
sources
=
new
MutablePropertySources
();
sources
.
addFirst
(
new
MapPropertySource
(
"test"
,
Collections
.
singletonMap
(
"a"
,
"b"
)));
sources
.
addFirst
(
new
MapPropertySource
(
"test"
,
Collections
.
singletonMap
(
"a"
,
"b"
)));
Iterator
<
ConfigurationPropertySource
>
iterator
=
new
SpringConfigurationPropertySources
(
sources
).
iterator
();
ConfigurationPropertyName
name
=
ConfigurationPropertyName
.
of
(
"a"
);
...
...
@@ -83,8 +83,8 @@ public class SpringConfigurationPropertySourcesTests {
Collections
.
singletonMap
(
"SERVER_PORT"
,
"1234"
)));
sources
.
addLast
(
new
MapPropertySource
(
"test1"
,
Collections
.
singletonMap
(
"server.po-rt"
,
"4567"
)));
sources
.
addLast
(
new
MapPropertySource
(
"test2"
,
Collections
.
singletonMap
(
"a"
,
"b"
)));
sources
.
addLast
(
new
MapPropertySource
(
"test2"
,
Collections
.
singletonMap
(
"a"
,
"b"
)));
Iterator
<
ConfigurationPropertySource
>
iterator
=
new
SpringConfigurationPropertySources
(
sources
).
iterator
();
ConfigurationPropertyName
name
=
ConfigurationPropertyName
.
of
(
"server.port"
);
...
...
@@ -101,10 +101,10 @@ public class SpringConfigurationPropertySourcesTests {
@Test
public
void
shouldFlattenEnvironment
()
throws
Exception
{
StandardEnvironment
environment
=
new
StandardEnvironment
();
environment
.
getPropertySources
().
addFirst
(
new
MapPropertySource
(
"foo"
,
Collections
.
singletonMap
(
"foo"
,
"bar"
)));
environment
.
getPropertySources
().
addFirst
(
new
MapPropertySource
(
"far"
,
Collections
.
singletonMap
(
"far"
,
"far"
)));
environment
.
getPropertySources
().
addFirst
(
new
MapPropertySource
(
"foo"
,
Collections
.
singletonMap
(
"foo"
,
"bar"
)));
environment
.
getPropertySources
().
addFirst
(
new
MapPropertySource
(
"far"
,
Collections
.
singletonMap
(
"far"
,
"far"
)));
MutablePropertySources
sources
=
new
MutablePropertySources
();
sources
.
addFirst
(
new
PropertySource
<
Environment
>(
"env"
,
environment
)
{
...
...
@@ -114,8 +114,8 @@ public class SpringConfigurationPropertySourcesTests {
}
});
sources
.
addLast
(
new
MapPropertySource
(
"baz"
,
Collections
.
singletonMap
(
"baz"
,
"barf"
)));
sources
.
addLast
(
new
MapPropertySource
(
"baz"
,
Collections
.
singletonMap
(
"baz"
,
"barf"
)));
SpringConfigurationPropertySources
configurationSources
=
new
SpringConfigurationPropertySources
(
sources
);
assertThat
(
configurationSources
.
iterator
()).
hasSize
(
5
);
...
...
@@ -124,11 +124,11 @@ public class SpringConfigurationPropertySourcesTests {
@Test
public
void
shouldTrackChanges
()
throws
Exception
{
MutablePropertySources
sources
=
new
MutablePropertySources
();
sources
.
addLast
(
new
MapPropertySource
(
"test1"
,
Collections
.
singletonMap
(
"a"
,
"b"
)));
sources
.
addLast
(
new
MapPropertySource
(
"test1"
,
Collections
.
singletonMap
(
"a"
,
"b"
)));
assertThat
(
new
SpringConfigurationPropertySources
(
sources
).
iterator
()).
hasSize
(
1
);
sources
.
addLast
(
new
MapPropertySource
(
"test2"
,
Collections
.
singletonMap
(
"b"
,
"c"
)));
sources
.
addLast
(
new
MapPropertySource
(
"test2"
,
Collections
.
singletonMap
(
"b"
,
"c"
)));
assertThat
(
new
SpringConfigurationPropertySources
(
sources
).
iterator
()).
hasSize
(
2
);
}
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java
View file @
2b426c30
...
...
@@ -185,8 +185,7 @@ public class RestTemplateBuilderTests {
@Test
public
void
defaultMessageConvertersShouldSetDefaultList
()
throws
Exception
{
RestTemplate
template
=
new
RestTemplate
(
Collections
.
singletonList
(
new
StringHttpMessageConverter
()));
Collections
.
singletonList
(
new
StringHttpMessageConverter
()));
this
.
builder
.
defaultMessageConverters
().
configure
(
template
);
assertThat
(
template
.
getMessageConverters
())
.
hasSameSizeAs
(
new
RestTemplate
().
getMessageConverters
());
...
...
@@ -195,8 +194,7 @@ public class RestTemplateBuilderTests {
@Test
public
void
defaultMessageConvertersShouldClearExisting
()
throws
Exception
{
RestTemplate
template
=
new
RestTemplate
(
Collections
.
singletonList
(
new
StringHttpMessageConverter
()));
Collections
.
singletonList
(
new
StringHttpMessageConverter
()));
this
.
builder
.
additionalMessageConverters
(
this
.
messageConverter
)
.
defaultMessageConverters
().
configure
(
template
);
assertThat
(
template
.
getMessageConverters
())
...
...
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