parent
6168fae720
commit
2b426c30a6
|
|
@ -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())
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -87,8 +87,7 @@ public class ActiveMQPropertiesTests {
|
|||
|
||||
private ActiveMQConnectionFactoryFactory createFactory(
|
||||
ActiveMQProperties properties) {
|
||||
return new ActiveMQConnectionFactoryFactory(properties,
|
||||
Collections.emptyList());
|
||||
return new ActiveMQConnectionFactoryFactory(properties, Collections.emptyList());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Reference in New Issue