Merge pull request #20226 from izeye

* pr/20226:
  Update copyright year of changed files
  Polish

Closes gh-20226
pull/20230/head
Stephane Nicoll 5 years ago
commit fc3fb7fb44

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 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.
@ -240,8 +240,7 @@ class ReactiveCloudFoundryActuatorAutoConfigurationTests {
ExposableWebEndpoint endpoint = endpoints.iterator().next();
assertThat(endpoint.getOperations()).hasSize(2);
WebOperation webOperation = findOperationWithRequestPath(endpoint, "health");
Object invoker = ReflectionTestUtils.getField(webOperation, "invoker");
assertThat(ReflectionTestUtils.getField(invoker, "target"))
assertThat(webOperation).extracting("invoker").extracting("target")
.isInstanceOf(CloudFoundryReactiveHealthEndpointWebExtension.class);
});
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 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.
@ -231,8 +231,7 @@ class CloudFoundryActuatorAutoConfigurationTests {
ExposableWebEndpoint endpoint = endpoints.iterator().next();
assertThat(endpoint.getOperations()).hasSize(2);
WebOperation webOperation = findOperationWithRequestPath(endpoint, "health");
Object invoker = ReflectionTestUtils.getField(webOperation, "invoker");
assertThat(ReflectionTestUtils.getField(invoker, "target"))
assertThat(webOperation).extracting("invoker").extracting("target")
.isInstanceOf(CloudFoundryHealthEndpointWebExtension.class);
});
}

@ -33,7 +33,6 @@ import org.springframework.boot.test.system.CapturedOutput;
import org.springframework.boot.test.system.OutputCaptureExtension;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.test.web.reactive.server.WebTestClient;
import static org.assertj.core.api.Assertions.assertThat;
@ -57,8 +56,8 @@ class WebFluxMetricsAutoConfigurationTests {
this.contextRunner.run((context) -> {
assertThat(context).getBeans(MetricsWebFilter.class).hasSize(1);
assertThat(context).getBeans(DefaultWebFluxTagsProvider.class).hasSize(1);
assertThat(ReflectionTestUtils.getField(context.getBean(DefaultWebFluxTagsProvider.class),
"ignoreTrailingSlash")).isEqualTo(true);
assertThat(context.getBean(DefaultWebFluxTagsProvider.class)).extracting("ignoreTrailingSlash")
.isEqualTo(true);
});
}
@ -67,8 +66,8 @@ class WebFluxMetricsAutoConfigurationTests {
this.contextRunner.withPropertyValues("management.metrics.web.server.request.ignore-trailing-slash=false")
.run((context) -> {
assertThat(context).hasSingleBean(DefaultWebFluxTagsProvider.class);
assertThat(ReflectionTestUtils.getField(context.getBean(DefaultWebFluxTagsProvider.class),
"ignoreTrailingSlash")).isEqualTo(false);
assertThat(context.getBean(DefaultWebFluxTagsProvider.class)).extracting("ignoreTrailingSlash")
.isEqualTo(false);
});
}

@ -50,7 +50,6 @@ import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
@ -84,8 +83,8 @@ class WebMvcMetricsAutoConfigurationTests {
void definesTagsProviderAndFilterWhenMeterRegistryIsPresent() {
this.contextRunner.run((context) -> {
assertThat(context).hasSingleBean(DefaultWebMvcTagsProvider.class);
assertThat(ReflectionTestUtils.getField(context.getBean(DefaultWebMvcTagsProvider.class),
"ignoreTrailingSlash")).isEqualTo(true);
assertThat(context.getBean(DefaultWebMvcTagsProvider.class)).extracting("ignoreTrailingSlash")
.isEqualTo(true);
assertThat(context).hasSingleBean(FilterRegistrationBean.class);
assertThat(context.getBean(FilterRegistrationBean.class).getFilter())
.isInstanceOf(WebMvcMetricsFilter.class);
@ -97,8 +96,8 @@ class WebMvcMetricsAutoConfigurationTests {
this.contextRunner.withPropertyValues("management.metrics.web.server.request.ignore-trailing-slash=false")
.run((context) -> {
assertThat(context).hasSingleBean(DefaultWebMvcTagsProvider.class);
assertThat(ReflectionTestUtils.getField(context.getBean(DefaultWebMvcTagsProvider.class),
"ignoreTrailingSlash")).isEqualTo(false);
assertThat(context.getBean(DefaultWebMvcTagsProvider.class)).extracting("ignoreTrailingSlash")
.isEqualTo(false);
});
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 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.boot.test.context.runner.WebApplicationContextRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.web.util.matcher.RequestMatcher;
import org.springframework.test.util.ReflectionTestUtils;
import static org.assertj.core.api.Assertions.assertThat;
@ -64,7 +63,7 @@ class SecurityRequestMatchersManagementContextConfigurationTests {
this.contextRunner.withUserConfiguration(TestMvcConfiguration.class).run((context) -> {
AntPathRequestMatcherProvider matcherProvider = context.getBean(AntPathRequestMatcherProvider.class);
RequestMatcher requestMatcher = matcherProvider.getRequestMatcher("/example");
assertThat(ReflectionTestUtils.getField(requestMatcher, "pattern")).isEqualTo("/custom/example");
assertThat(requestMatcher).extracting("pattern").isEqualTo("/custom/example");
});
}
@ -75,7 +74,7 @@ class SecurityRequestMatchersManagementContextConfigurationTests {
AntPathRequestMatcherProvider matcherProvider = context
.getBean(AntPathRequestMatcherProvider.class);
RequestMatcher requestMatcher = matcherProvider.getRequestMatcher("/example");
assertThat(ReflectionTestUtils.getField(requestMatcher, "pattern")).isEqualTo("/admin/example");
assertThat(requestMatcher).extracting("pattern").isEqualTo("/admin/example");
});
}

@ -79,8 +79,7 @@ class CassandraDataAutoConfigurationTests {
void userTypeResolverShouldBeSet() {
load();
CassandraMappingContext mappingContext = this.context.getBean(CassandraMappingContext.class);
assertThat(ReflectionTestUtils.getField(mappingContext, "userTypeResolver"))
.isInstanceOf(SimpleUserTypeResolver.class);
assertThat(mappingContext).extracting("userTypeResolver").isInstanceOf(SimpleUserTypeResolver.class);
}
@Test

@ -75,8 +75,7 @@ class CassandraReactiveDataAutoConfigurationTests {
void userTypeResolverShouldBeSet() {
load("spring.data.cassandra.keyspaceName:boot_test");
CassandraMappingContext mappingContext = this.context.getBean(CassandraMappingContext.class);
assertThat(ReflectionTestUtils.getField(mappingContext, "userTypeResolver"))
.isInstanceOf(SimpleUserTypeResolver.class);
assertThat(mappingContext).extracting("userTypeResolver").isInstanceOf(SimpleUserTypeResolver.class);
}
private void load(String... environment) {

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 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.
@ -389,7 +389,7 @@ class KafkaAutoConfigurationTests {
assertThat(containerProperties.getMonitorInterval()).isEqualTo(45);
assertThat(containerProperties.isLogContainerConfig()).isTrue();
assertThat(containerProperties.isMissingTopicsFatal()).isFalse();
assertThat(ReflectionTestUtils.getField(kafkaListenerContainerFactory, "concurrency")).isEqualTo(3);
assertThat(kafkaListenerContainerFactory).extracting("concurrency").isEqualTo(3);
assertThat(kafkaListenerContainerFactory.isBatchListener()).isTrue();
assertThat(context.getBeansOfType(KafkaJaasLoginModuleInitializer.class)).hasSize(1);
KafkaJaasLoginModuleInitializer jaas = context.getBean(KafkaJaasLoginModuleInitializer.class);

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 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.
@ -41,7 +41,6 @@ import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.test.util.ReflectionTestUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
@ -92,8 +91,7 @@ class TaskExecutionAutoConfigurationTests {
this.contextRunner.withUserConfiguration(TaskDecoratorConfig.class).run((context) -> {
assertThat(context).hasSingleBean(TaskExecutorBuilder.class);
ThreadPoolTaskExecutor executor = context.getBean(TaskExecutorBuilder.class).build();
assertThat(ReflectionTestUtils.getField(executor, "taskDecorator"))
.isSameAs(context.getBean(TaskDecorator.class));
assertThat(executor).extracting("taskDecorator").isSameAs(context.getBean(TaskDecorator.class));
});
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 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.
@ -380,16 +380,15 @@ class WebMvcAutoConfigurationTests {
@Test
void defaultAsyncRequestTimeout() {
this.contextRunner.run((context) -> assertThat(ReflectionTestUtils
.getField(context.getBean(RequestMappingHandlerAdapter.class), "asyncRequestTimeout")).isNull());
this.contextRunner.run((context) -> assertThat(context.getBean(RequestMappingHandlerAdapter.class))
.extracting("asyncRequestTimeout").isNull());
}
@Test
void customAsyncRequestTimeout() {
this.contextRunner.withPropertyValues("spring.mvc.async.request-timeout:12345")
.run((context) -> assertThat(ReflectionTestUtils
.getField(context.getBean(RequestMappingHandlerAdapter.class), "asyncRequestTimeout"))
.isEqualTo(12345L));
.run((context) -> assertThat(context.getBean(RequestMappingHandlerAdapter.class))
.extracting("asyncRequestTimeout").isEqualTo(12345L));
}
@Test
@ -397,8 +396,8 @@ class WebMvcAutoConfigurationTests {
this.contextRunner.withConfiguration(AutoConfigurations.of(TaskExecutionAutoConfiguration.class))
.run((context) -> {
assertThat(context).hasSingleBean(AsyncTaskExecutor.class);
assertThat(ReflectionTestUtils.getField(context.getBean(RequestMappingHandlerAdapter.class),
"taskExecutor")).isSameAs(context.getBean("applicationTaskExecutor"));
assertThat(context.getBean(RequestMappingHandlerAdapter.class)).extracting("taskExecutor")
.isSameAs(context.getBean("applicationTaskExecutor"));
});
}
@ -407,8 +406,8 @@ class WebMvcAutoConfigurationTests {
this.contextRunner.withUserConfiguration(CustomApplicationTaskExecutorConfig.class)
.withConfiguration(AutoConfigurations.of(TaskExecutionAutoConfiguration.class)).run((context) -> {
assertThat(context).doesNotHaveBean(AsyncTaskExecutor.class);
assertThat(ReflectionTestUtils.getField(context.getBean(RequestMappingHandlerAdapter.class),
"taskExecutor")).isNotSameAs(context.getBean("applicationTaskExecutor"));
assertThat(context.getBean(RequestMappingHandlerAdapter.class)).extracting("taskExecutor")
.isNotSameAs(context.getBean("applicationTaskExecutor"));
});
}
@ -416,8 +415,8 @@ class WebMvcAutoConfigurationTests {
void asyncTaskExecutorWithMvcConfigurerCanOverrideExecutor() {
this.contextRunner.withUserConfiguration(CustomAsyncTaskExecutorConfigurer.class)
.withConfiguration(AutoConfigurations.of(TaskExecutionAutoConfiguration.class))
.run((context) -> assertThat(ReflectionTestUtils
.getField(context.getBean(RequestMappingHandlerAdapter.class), "taskExecutor"))
.run((context) -> assertThat(context.getBean(RequestMappingHandlerAdapter.class))
.extracting("taskExecutor")
.isSameAs(context.getBean(CustomAsyncTaskExecutorConfigurer.class).taskExecutor));
}
@ -426,8 +425,8 @@ class WebMvcAutoConfigurationTests {
this.contextRunner.withUserConfiguration(CustomAsyncTaskExecutorConfig.class)
.withConfiguration(AutoConfigurations.of(TaskExecutionAutoConfiguration.class)).run((context) -> {
assertThat(context).hasSingleBean(AsyncTaskExecutor.class);
assertThat(ReflectionTestUtils.getField(context.getBean(RequestMappingHandlerAdapter.class),
"taskExecutor")).isNotSameAs(context.getBean("customTaskExecutor"));
assertThat(context.getBean(RequestMappingHandlerAdapter.class)).extracting("taskExecutor")
.isNotSameAs(context.getBean("customTaskExecutor"));
});
}
@ -643,8 +642,7 @@ class WebMvcAutoConfigurationTests {
Validator validator = context.getBean(Validator.class);
assertThat(validator).isInstanceOf(ValidatorAdapter.class);
Validator target = ((ValidatorAdapter) validator).getTarget();
assertThat(ReflectionTestUtils.getField(target, "targetValidator"))
.isSameAs(context.getBean("customJsr303Validator"));
assertThat(target).extracting("targetValidator").isSameAs(context.getBean("customJsr303Validator"));
});
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 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 org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.ApplicationContext;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition;
import org.springframework.xml.xsd.SimpleXsdSchema;
@ -72,7 +71,7 @@ class WebServicesAutoConfigurationTests {
void customLoadOnStartup() {
this.contextRunner.withPropertyValues("spring.webservices.servlet.load-on-startup=1").run((context) -> {
ServletRegistrationBean<?> registrationBean = context.getBean(ServletRegistrationBean.class);
assertThat(ReflectionTestUtils.getField(registrationBean, "loadOnStartup")).isEqualTo(1);
assertThat(registrationBean).extracting("loadOnStartup").isEqualTo(1);
});
}

@ -104,7 +104,7 @@ public @interface DataJpaTest {
/**
* The {@link BootstrapMode} for the test repository support. Defaults to
* {@link BootstrapMode#LAZY}.
* @return the {@link BootstrapMode} to use for test the repository
* @return the {@link BootstrapMode} to use for testing the repository
*/
@PropertyMapping("spring.data.jpa.repositories.bootstrap-mode")
BootstrapMode bootstrapMode() default BootstrapMode.LAZY;

@ -28,7 +28,6 @@ import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguratio
import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.core.task.AsyncTaskExecutor;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
import static org.assertj.core.api.Assertions.assertThat;
@ -75,8 +74,8 @@ class WebMvcTestAutoConfigurationIntegrationTests {
@Test
void asyncTaskExecutorWithApplicationTaskExecutor() {
assertThat(this.applicationContext.getBeansOfType(AsyncTaskExecutor.class)).hasSize(1);
assertThat(ReflectionTestUtils.getField(this.applicationContext.getBean(RequestMappingHandlerAdapter.class),
"taskExecutor")).isSameAs(this.applicationContext.getBean("applicationTaskExecutor"));
assertThat(this.applicationContext.getBean(RequestMappingHandlerAdapter.class)).extracting("taskExecutor")
.isSameAs(this.applicationContext.getBean("applicationTaskExecutor"));
}
@Test

@ -4,7 +4,7 @@
The plugin can create an https://github.com/opencontainers/image-spec[OCI image] using https://buildpacks.io/[Cloud Native Buildpacks].
Images can be built using the `build-image` goal and a local Docker installation.
The easiest way to get started is to to invoke `mvn spring-boot:build-image` on a project.
The easiest way to get started is to invoke `mvn spring-boot:build-image` on a project.
It is possible to automate the creation of an image whenever the `package` phase is invoked, as shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 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.Test;
import org.springframework.core.task.TaskDecorator;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.test.util.ReflectionTestUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
@ -76,7 +75,7 @@ class TaskExecutorBuilderTests {
void taskDecoratorShouldApply() {
TaskDecorator taskDecorator = mock(TaskDecorator.class);
ThreadPoolTaskExecutor executor = this.builder.taskDecorator(taskDecorator).build();
assertThat(ReflectionTestUtils.getField(executor, "taskDecorator")).isSameAs(taskDecorator);
assertThat(executor).extracting("taskDecorator").isSameAs(taskDecorator);
}
@Test

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 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.
@ -541,8 +541,7 @@ class RestTemplateBuilderTests {
void readTimeoutCanBeConfiguredOnOkHttp3RequestFactory() {
ClientHttpRequestFactory requestFactory = this.builder.requestFactory(OkHttp3ClientHttpRequestFactory.class)
.setReadTimeout(Duration.ofMillis(1234)).build().getRequestFactory();
assertThat(ReflectionTestUtils.getField(ReflectionTestUtils.getField(requestFactory, "client"), "readTimeout"))
.isEqualTo(1234);
assertThat(requestFactory).extracting("client").extracting("readTimeout").isEqualTo(1234);
}
@Test

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 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.mock.web.MockFilterConfig;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletContext;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.web.context.support.GenericWebApplicationContext;
import org.springframework.web.filter.DelegatingFilterProxy;
import org.springframework.web.filter.GenericFilterBean;
@ -72,8 +71,8 @@ class DelegatingFilterProxyRegistrationBeanTests extends AbstractFilterRegistrat
DelegatingFilterProxyRegistrationBean registrationBean = createFilterRegistrationBean();
Filter filter = registrationBean.getFilter();
assertThat(filter).isInstanceOf(DelegatingFilterProxy.class);
assertThat(ReflectionTestUtils.getField(filter, "webApplicationContext")).isEqualTo(this.applicationContext);
assertThat(ReflectionTestUtils.getField(filter, "targetBeanName")).isEqualTo("mockFilter");
assertThat(filter).extracting("webApplicationContext").isEqualTo(this.applicationContext);
assertThat(filter).extracting("targetBeanName").isEqualTo("mockFilter");
}
@Test

Loading…
Cancel
Save