diff --git a/buildSrc/src/main/java/org/springframework/boot/build/context/properties/ConfigurationPropertiesPlugin.java b/buildSrc/src/main/java/org/springframework/boot/build/context/properties/ConfigurationPropertiesPlugin.java index 776a210252..ccc094539e 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/context/properties/ConfigurationPropertiesPlugin.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/context/properties/ConfigurationPropertiesPlugin.java @@ -25,7 +25,6 @@ import org.gradle.api.Task; import org.gradle.api.artifacts.Configuration; import org.gradle.api.file.RegularFile; import org.gradle.api.plugins.JavaPlugin; -import org.gradle.api.plugins.JavaPluginConvention; import org.gradle.api.plugins.JavaPluginExtension; import org.gradle.api.provider.Provider; import org.gradle.api.tasks.PathSensitivity; @@ -145,7 +144,7 @@ public class ConfigurationPropertiesPlugin implements Plugin { TaskProvider checkConfigurationMetadata = project.getTasks() .register(CHECK_SPRING_CONFIGURATION_METADATA_TASK_NAME, CheckSpringConfigurationMetadata.class); checkConfigurationMetadata.configure((check) -> { - SourceSet mainSourceSet = project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets() + SourceSet mainSourceSet = project.getExtensions().getByType(JavaPluginExtension.class).getSourceSets() .getByName(SourceSet.MAIN_SOURCE_SET_NAME); Provider metadataLocation = project.getTasks() .named(mainSourceSet.getCompileJavaTaskName(), JavaCompile.class) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/web/reactive/ServerRequestObservationConventionAdapter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/web/reactive/ServerRequestObservationConventionAdapter.java index 93df517940..3b3890e910 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/web/reactive/ServerRequestObservationConventionAdapter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/web/reactive/ServerRequestObservationConventionAdapter.java @@ -34,6 +34,7 @@ import org.springframework.http.observation.reactive.ServerRequestObservationCon * @author Brian Clozel */ @SuppressWarnings("removal") +@Deprecated(since = "3.0.0", forRemoval = true) class ServerRequestObservationConventionAdapter implements ServerRequestObservationConvention { private final String name; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/web/servlet/ServerRequestObservationConventionAdapter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/web/servlet/ServerRequestObservationConventionAdapter.java index 8a3591ac90..dfc6427ae1 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/web/servlet/ServerRequestObservationConventionAdapter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/web/servlet/ServerRequestObservationConventionAdapter.java @@ -36,7 +36,8 @@ import org.springframework.web.servlet.HandlerMapping; * * @author Brian Clozel */ -@SuppressWarnings({ "deprecation", "removal" }) +@SuppressWarnings("removal") +@Deprecated(since = "3.0.0", forRemoval = true) class ServerRequestObservationConventionAdapter implements ServerRequestObservationConvention { private final String observationName; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/context/properties/ConfigurationPropertiesReportEndpointAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/context/properties/ConfigurationPropertiesReportEndpointAutoConfigurationTests.java index 8fbe048101..a42f86e15a 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/context/properties/ConfigurationPropertiesReportEndpointAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/context/properties/ConfigurationPropertiesReportEndpointAutoConfigurationTests.java @@ -77,7 +77,6 @@ class ConfigurationPropertiesReportEndpointAutoConfigurationTests { } @Test - @SuppressWarnings("unchecked") void showValuesCanBeConfiguredViaTheEnvironment() { this.contextRunner.withUserConfiguration(Config.class) .withPropertyValues("management.endpoint.configprops.show-values: WHEN_AUTHORIZED") diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/env/EnvironmentEndpointAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/env/EnvironmentEndpointAutoConfigurationTests.java index 9bf3308537..30226b9953 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/env/EnvironmentEndpointAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/env/EnvironmentEndpointAutoConfigurationTests.java @@ -97,7 +97,6 @@ class EnvironmentEndpointAutoConfigurationTests { } @Test - @SuppressWarnings("unchecked") void showValuesCanBeConfiguredViaTheEnvironment() { this.contextRunner.withPropertyValues("management.endpoint.env.show-values: WHEN_AUTHORIZED") .withPropertyValues("management.endpoints.web.exposure.include=env") @@ -107,10 +106,8 @@ class EnvironmentEndpointAutoConfigurationTests { EnvironmentEndpointWebExtension webExtension = context .getBean(EnvironmentEndpointWebExtension.class); EnvironmentEndpoint endpoint = context.getBean(EnvironmentEndpoint.class); - Show showValuesWebExtension = (Show) ReflectionTestUtils.getField(webExtension, "showValues"); - assertThat(showValuesWebExtension).isEqualTo(Show.WHEN_AUTHORIZED); - Show showValues = (Show) ReflectionTestUtils.getField(endpoint, "showValues"); - assertThat(showValues).isEqualTo(Show.WHEN_AUTHORIZED); + assertThat(webExtension).extracting("showValues").isEqualTo(Show.WHEN_AUTHORIZED); + assertThat(endpoint).extracting("showValues").isEqualTo(Show.WHEN_AUTHORIZED); }); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/client/RestTemplateObservationConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/client/RestTemplateObservationConfigurationTests.java index 0dcfc3d962..3727f47d11 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/client/RestTemplateObservationConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/client/RestTemplateObservationConfigurationTests.java @@ -54,7 +54,7 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat * @author Brian Clozel */ @ExtendWith(OutputCaptureExtension.class) -@SuppressWarnings({ "deprecation", "removal" }) +@SuppressWarnings("removal") class RestTemplateObservationConfigurationTests { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/client/WebClientObservationConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/client/WebClientObservationConfigurationTests.java index 91a218b66a..f07b3f41c1 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/client/WebClientObservationConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/client/WebClientObservationConfigurationTests.java @@ -55,7 +55,7 @@ import static org.mockito.Mockito.mock; * @author Stephane Nicoll */ @ExtendWith(OutputCaptureExtension.class) -@SuppressWarnings({ "deprecation", "removal" }) +@SuppressWarnings("removal") class WebClientObservationConfigurationTests { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner().with(MetricsRun.simple()) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/reactive/ServerRequestObservationConventionAdapterTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/reactive/ServerRequestObservationConventionAdapterTests.java index 8f1c79c89d..24f6fc64ce 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/reactive/ServerRequestObservationConventionAdapterTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/reactive/ServerRequestObservationConventionAdapterTests.java @@ -34,6 +34,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Brian Clozel */ @SuppressWarnings("removal") +@Deprecated(since = "3.0.0", forRemoval = true) class ServerRequestObservationConventionAdapterTests { private static final String TEST_METRIC_NAME = "test.metric.name"; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/reactive/WebFluxObservationAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/reactive/WebFluxObservationAutoConfigurationTests.java index e5a7fadf17..6cb1ac4d5d 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/reactive/WebFluxObservationAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/reactive/WebFluxObservationAutoConfigurationTests.java @@ -76,6 +76,7 @@ class WebFluxObservationAutoConfigurationTests { }); } + @Deprecated(since = "3.0.0", forRemoval = true) @Configuration(proxyBeanMethods = false) static class CustomTagsProviderConfiguration { @@ -96,6 +97,7 @@ class WebFluxObservationAutoConfigurationTests { } + @Deprecated(since = "3.0.0", forRemoval = true) static class CustomTagsContributor implements WebFluxTagsContributor { @Override diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/servlet/ServerRequestObservationConventionAdapterTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/servlet/ServerRequestObservationConventionAdapterTests.java index 018d67daa1..4309e009d5 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/servlet/ServerRequestObservationConventionAdapterTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/servlet/ServerRequestObservationConventionAdapterTests.java @@ -41,6 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Brian Clozel */ @SuppressWarnings("removal") +@Deprecated(since = "3.0.0", forRemoval = true) class ServerRequestObservationConventionAdapterTests { private static final String TEST_METRIC_NAME = "test.metric.name"; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/servlet/WebMvcObservationAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/servlet/WebMvcObservationAutoConfigurationTests.java index cd53d14100..5c9d12c251 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/servlet/WebMvcObservationAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/web/servlet/WebMvcObservationAutoConfigurationTests.java @@ -210,6 +210,7 @@ class WebMvcObservationAutoConfigurationTests { } + @Deprecated(since = "3.0.0", forRemoval = true) private static final class TestWebMvcTagsProvider implements WebMvcTagsProvider { @Override diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/quartz/QuartzEndpointAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/quartz/QuartzEndpointAutoConfigurationTests.java index c535fd95eb..e05f3e947f 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/quartz/QuartzEndpointAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/quartz/QuartzEndpointAutoConfigurationTests.java @@ -101,16 +101,14 @@ class QuartzEndpointAutoConfigurationTests { } @Test - @SuppressWarnings("unchecked") void showValuesCanBeConfiguredViaTheEnvironment() { this.contextRunner.withBean(Scheduler.class, () -> mock(Scheduler.class)) .withPropertyValues("management.endpoint.quartz.show-values: WHEN_AUTHORIZED") .withPropertyValues("management.endpoints.web.exposure.include=quartz") .withSystemProperties("dbPassword=123456", "apiKey=123456").run((context) -> { assertThat(context).hasSingleBean(QuartzEndpointWebExtension.class); - QuartzEndpointWebExtension webExtension = context.getBean(QuartzEndpointWebExtension.class); - Show showValuesWebExtension = (Show) ReflectionTestUtils.getField(webExtension, "showValues"); - assertThat(showValuesWebExtension).isEqualTo(Show.WHEN_AUTHORIZED); + assertThat(context.getBean(QuartzEndpointWebExtension.class)).extracting("showValues") + .isEqualTo(Show.WHEN_AUTHORIZED); }); } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/jersey/JerseyEndpointResourceFactory.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/jersey/JerseyEndpointResourceFactory.java index 3fc88b0f6c..0b80224ea4 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/jersey/JerseyEndpointResourceFactory.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/jersey/JerseyEndpointResourceFactory.java @@ -239,21 +239,16 @@ public class JerseyEndpointResourceFactory { Status status = isGet ? Status.NOT_FOUND : Status.NO_CONTENT; return Response.status(status).build(); } - try { - if (!(response instanceof WebEndpointResponse)) { - return Response.status(Status.OK).entity(convertIfNecessary(response)).build(); - } - WebEndpointResponse webEndpointResponse = (WebEndpointResponse) response; - return Response.status(webEndpointResponse.getStatus()) - .header("Content-Type", webEndpointResponse.getContentType()) - .entity(convertIfNecessary(webEndpointResponse.getBody())).build(); - } - catch (IOException ex) { - return Response.status(Status.INTERNAL_SERVER_ERROR).build(); + if (!(response instanceof WebEndpointResponse)) { + return Response.status(Status.OK).entity(convertIfNecessary(response)).build(); } + WebEndpointResponse webEndpointResponse = (WebEndpointResponse) response; + return Response.status(webEndpointResponse.getStatus()) + .header("Content-Type", webEndpointResponse.getContentType()) + .entity(convertIfNecessary(webEndpointResponse.getBody())).build(); } - private Object convertIfNecessary(Object body) throws IOException { + private Object convertIfNecessary(Object body) { for (Function converter : BODY_CONVERTERS) { body = converter.apply(body); } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping.java index 5f85880e12..3fbf042a13 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping.java @@ -140,7 +140,6 @@ public abstract class AbstractWebMvcEndpointHandlerMapping extends RequestMappin } @Override - @SuppressWarnings("deprecation") public void afterPropertiesSet() { this.builderConfig = new RequestMappingInfo.BuilderConfiguration(); this.builderConfig.setPatternParser(getPatternParser()); diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMapping.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMapping.java index 47881ea83b..859ad2b816 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMapping.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMapping.java @@ -58,7 +58,6 @@ public class ControllerEndpointHandlerMapping extends RequestMappingHandlerMappi * @param endpoints the web endpoints * @param corsConfiguration the CORS configuration for the endpoints or {@code null} */ - @SuppressWarnings("deprecation") public ControllerEndpointHandlerMapping(EndpointMapping endpointMapping, Collection endpoints, CorsConfiguration corsConfiguration) { Assert.notNull(endpointMapping, "EndpointMapping must not be null"); diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/DefaultRestTemplateExchangeTagsProvider.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/DefaultRestTemplateExchangeTagsProvider.java index 18f9965318..ace3689e68 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/DefaultRestTemplateExchangeTagsProvider.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/DefaultRestTemplateExchangeTagsProvider.java @@ -34,7 +34,7 @@ import org.springframework.util.StringUtils; * {@link org.springframework.http.client.observation.DefaultClientRequestObservationConvention} */ @Deprecated(since = "3.0.0", forRemoval = true) -@SuppressWarnings({ "deprecation", "removal" }) +@SuppressWarnings("removal") public class DefaultRestTemplateExchangeTagsProvider implements RestTemplateExchangeTagsProvider { @Override diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/DefaultWebClientExchangeTagsProvider.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/DefaultWebClientExchangeTagsProvider.java index 00b62018a0..aeae3222d5 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/DefaultWebClientExchangeTagsProvider.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/DefaultWebClientExchangeTagsProvider.java @@ -33,7 +33,7 @@ import org.springframework.web.reactive.function.client.ClientResponse; * {@link org.springframework.web.reactive.function.client.ClientRequestObservationConvention} */ @Deprecated(since = "3.0.0", forRemoval = true) -@SuppressWarnings({ "deprecation", "removal" }) +@SuppressWarnings("removal") public class DefaultWebClientExchangeTagsProvider implements WebClientExchangeTagsProvider { @Override diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/DefaultWebMvcTagsProviderTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/DefaultWebMvcTagsProviderTests.java index ab2a3cc3a6..e84a947074 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/DefaultWebMvcTagsProviderTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/DefaultWebMvcTagsProviderTests.java @@ -41,6 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Andy Wilkinson */ @SuppressWarnings("removal") +@Deprecated(since = "3.0.0", forRemoval = true) class DefaultWebMvcTagsProviderTests { @Test diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/WebMvcTagsTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/WebMvcTagsTests.java index 03ef6502a2..7097ee9dfd 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/WebMvcTagsTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/WebMvcTagsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2022 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. @@ -35,6 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Michael McFadyen */ @SuppressWarnings("removal") +@Deprecated(since = "3.0.0", forRemoval = true) class WebMvcTagsTests { private final MockHttpServletRequest request = new MockHttpServletRequest(); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/client/ObservationWebClientCustomizerTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/client/ObservationWebClientCustomizerTests.java index 3aa6f01dbc..714d340237 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/client/ObservationWebClientCustomizerTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/client/ObservationWebClientCustomizerTests.java @@ -30,7 +30,6 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author Brian Clozel */ -@SuppressWarnings("deprecation") class ObservationWebClientCustomizerTests { private static final String TEST_METRIC_NAME = "http.test.metric.name"; diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/DefaultWebFluxTagsProviderTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/DefaultWebFluxTagsProviderTests.java index 4298a98977..e35cc5676b 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/DefaultWebFluxTagsProviderTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/DefaultWebFluxTagsProviderTests.java @@ -38,6 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Andy Wilkinson */ @SuppressWarnings("removal") +@Deprecated(since = "3.0.0", forRemoval = true) class DefaultWebFluxTagsProviderTests { @Test diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/WebFluxTagsTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/WebFluxTagsTests.java index ff74111808..60f913f2ae 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/WebFluxTagsTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/WebFluxTagsTests.java @@ -45,6 +45,7 @@ import static org.mockito.Mockito.mock; * @author Stephane Nicoll */ @SuppressWarnings("removal") +@Deprecated(since = "3.0.0", forRemoval = true) class WebFluxTagsTests { private MockServerWebExchange exchange; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/graphql/servlet/GraphQlWebMvcAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/graphql/servlet/GraphQlWebMvcAutoConfiguration.java index 11cdedb503..d657ec6006 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/graphql/servlet/GraphQlWebMvcAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/graphql/servlet/GraphQlWebMvcAutoConfiguration.java @@ -180,7 +180,6 @@ public class GraphQlWebMvcAutoConfiguration { } @Bean - @SuppressWarnings("deprecation") public HandlerMapping graphQlWebSocketMapping(GraphQlWebSocketHandler handler, GraphQlProperties properties) { String path = properties.getWebsocket().getPath(); logger.info(LogMessage.format("GraphQL endpoint WebSocket %s", path)); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerAutoConfigurationTests.java index 16ca830f8a..318b849faa 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerAutoConfigurationTests.java @@ -423,7 +423,6 @@ class OAuth2ResourceServerAutoConfigurationTests { .run((context) -> assertThat(context).doesNotHaveBean(OpaqueTokenIntrospector.class)); } - @SuppressWarnings("unchecked") @Test void autoConfigurationShouldConfigureResourceServerUsingJwkSetUriAndIssuerUri() throws Exception { this.server = new MockWebServer(); @@ -445,7 +444,6 @@ class OAuth2ResourceServerAutoConfigurationTests { }); } - @SuppressWarnings("unchecked") @Test void autoConfigurationShouldNotConfigureIssuerUriAndAudienceJwtValidatorIfPropertyNotConfigured() throws Exception { this.server = new MockWebServer(); @@ -523,7 +521,6 @@ class OAuth2ResourceServerAutoConfigurationTests { validateDelegates(issuerUri, delegates); } - @SuppressWarnings("unchecked") private void validateDelegates(String issuerUri, Collection> delegates) { assertThat(delegates).hasAtLeastOneElementOfType(JwtClaimValidator.class); OAuth2TokenValidator delegatingValidator = delegates.stream() diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration.java index dae1f7917e..96c0587575 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration.java @@ -99,8 +99,6 @@ public class LocalDevToolsAutoConfiguration { @ConditionalOnProperty(prefix = "spring.devtools.restart", name = "enabled", matchIfMissing = true) static class RestartConfiguration { - private static final Log restarterLogger = LogFactory.getLog(Restarter.class); - private final DevToolsProperties properties; RestartConfiguration(DevToolsProperties properties) { diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/SpringBootDependencyInjectionTestExecutionListenerTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/SpringBootDependencyInjectionTestExecutionListenerTests.java index a4fde2aaa8..e505242782 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/SpringBootDependencyInjectionTestExecutionListenerTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/SpringBootDependencyInjectionTestExecutionListenerTests.java @@ -53,7 +53,7 @@ class SpringBootDependencyInjectionTestExecutionListenerTests { } @Test - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) void prepareFailingTestInstanceShouldPrintReport(CapturedOutput output) throws Exception { TestContext testContext = mock(TestContext.class); given(testContext.getTestClass()).willReturn((Class) Config.class); @@ -73,7 +73,7 @@ class SpringBootDependencyInjectionTestExecutionListenerTests { } @Test - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) void originalFailureIsThrownWhenReportGenerationFails() { TestContext testContext = mock(TestContext.class); given(testContext.getTestClass()).willReturn((Class) Config.class); diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/ExampleProperties.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/ExampleProperties.java index 471547d21e..898ecf432c 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/ExampleProperties.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/client/ExampleProperties.java @@ -17,7 +17,7 @@ package org.springframework.boot.test.autoconfigure.web.client; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.ConstructorBinding; +import org.springframework.boot.context.properties.bind.ConstructorBinding; import org.springframework.boot.context.properties.bind.DefaultValue; /** diff --git a/spring-boot-project/spring-boot-tools/spring-boot-autoconfigure-processor/src/test/java/org/springframework/boot/autoconfigureprocessor/AutoConfigureAnnotationProcessorTests.java b/spring-boot-project/spring-boot-tools/spring-boot-autoconfigure-processor/src/test/java/org/springframework/boot/autoconfigureprocessor/AutoConfigureAnnotationProcessorTests.java index 748de73df7..4985ef6aef 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-autoconfigure-processor/src/test/java/org/springframework/boot/autoconfigureprocessor/AutoConfigureAnnotationProcessorTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-autoconfigure-processor/src/test/java/org/springframework/boot/autoconfigureprocessor/AutoConfigureAnnotationProcessorTests.java @@ -39,7 +39,7 @@ import static org.junit.jupiter.api.Assertions.fail; class AutoConfigureAnnotationProcessorTests { @Test - void annotatedClass() throws Exception { + void annotatedClass() { compile(TestClassConfiguration.class, (properties) -> { assertThat(properties).hasSize(7); assertThat(properties).containsEntry( @@ -108,7 +108,7 @@ class AutoConfigureAnnotationProcessorTests { } @Test - void annotatedClassWithAutoConfiguration() throws Exception { + void annotatedClassWithAutoConfiguration() { compile(TestAutoConfigurationConfiguration.class, (properties) -> { assertThat(properties).containsEntry( "org.springframework.boot.autoconfigureprocessor.TestAutoConfigurationConfiguration", ""); @@ -122,7 +122,7 @@ class AutoConfigureAnnotationProcessorTests { } @Test - void annotatedClassWithAutoConfigurationMerged() throws Exception { + void annotatedClassWithAutoConfigurationMerged() { compile(TestMergedAutoConfigurationConfiguration.class, (properties) -> { assertThat(properties).containsEntry( "org.springframework.boot.autoconfigureprocessor.TestMergedAutoConfigurationConfiguration", ""); @@ -136,7 +136,7 @@ class AutoConfigureAnnotationProcessorTests { } @Test // gh-19370 - void propertiesAreFullRepeatable() throws Exception { + void propertiesAreFullRepeatable() { process(TestOrderedClassConfiguration.class, (firstFile) -> { String first = getFileContents(firstFile); process(TestOrderedClassConfiguration.class, (secondFile) -> { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataStore.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataStore.java index 73c4f3259b..826c504b02 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataStore.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataStore.java @@ -76,7 +76,7 @@ public class MetadataStore { return readMetadata(getAdditionalMetadataStream()); } - private ConfigurationMetadata readMetadata(InputStream in) throws IOException { + private ConfigurationMetadata readMetadata(InputStream in) { try (in) { return new JsonMarshaller().read(in); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java index f2263ed27f..623f852e68 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java @@ -16,8 +16,6 @@ package org.springframework.boot.configurationprocessor; -import java.io.IOException; - import org.junit.jupiter.api.Test; import org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata; @@ -414,7 +412,7 @@ class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetadataGene } @Test - void recordProperties() throws IOException { + void recordProperties() { String source = """ @org.springframework.boot.configurationsample.ConfigurationProperties("implicit") public record ExampleRecord(String someString, Integer someInteger) { @@ -426,7 +424,7 @@ class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetadataGene } @Test - void recordPropertiesWithDefaultValues() throws IOException { + void recordPropertiesWithDefaultValues() { String source = """ @org.springframework.boot.configurationsample.ConfigurationProperties("record.defaults") public record ExampleRecord( @@ -442,7 +440,7 @@ class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetadataGene } @Test - void multiConstructorRecordProperties() throws IOException { + void multiConstructorRecordProperties() { String source = """ @org.springframework.boot.configurationsample.ConfigurationProperties("multi") public record ExampleRecord(String someString, Integer someInteger) { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConstructorParameterPropertyDescriptorTests.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConstructorParameterPropertyDescriptorTests.java index 8b3918c3e4..45cd1c0894 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConstructorParameterPropertyDescriptorTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConstructorParameterPropertyDescriptorTests.java @@ -16,7 +16,6 @@ package org.springframework.boot.configurationprocessor; -import java.io.IOException; import java.util.Arrays; import java.util.List; @@ -44,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat; class ConstructorParameterPropertyDescriptorTests extends PropertyDescriptorTests { @Test - void constructorParameterSimpleProperty() throws IOException { + void constructorParameterSimpleProperty() { process(ImmutableSimpleProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(ImmutableSimpleProperties.class); ConstructorParameterPropertyDescriptor property = createPropertyDescriptor(ownerElement, "theName"); @@ -57,7 +56,7 @@ class ConstructorParameterPropertyDescriptorTests extends PropertyDescriptorTest } @Test - void constructorParameterNestedPropertySameClass() throws IOException { + void constructorParameterNestedPropertySameClass() { process(ImmutableInnerClassProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(ImmutableInnerClassProperties.class); ConstructorParameterPropertyDescriptor property = createPropertyDescriptor(ownerElement, "first"); @@ -70,7 +69,7 @@ class ConstructorParameterPropertyDescriptorTests extends PropertyDescriptorTest } @Test - void constructorParameterNestedPropertyWithAnnotation() throws IOException { + void constructorParameterNestedPropertyWithAnnotation() { process(ImmutableInnerClassProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(ImmutableInnerClassProperties.class); ConstructorParameterPropertyDescriptor property = createPropertyDescriptor(ownerElement, "third"); @@ -83,7 +82,7 @@ class ConstructorParameterPropertyDescriptorTests extends PropertyDescriptorTest } @Test - void constructorParameterSimplePropertyWithNoAccessorShouldBeExposed() throws IOException { + void constructorParameterSimplePropertyWithNoAccessorShouldBeExposed() { process(ImmutableSimpleProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(ImmutableSimpleProperties.class); ConstructorParameterPropertyDescriptor property = createPropertyDescriptor(ownerElement, "counter"); @@ -96,7 +95,7 @@ class ConstructorParameterPropertyDescriptorTests extends PropertyDescriptorTest } @Test - void constructorParameterMetadataSimpleProperty() throws IOException { + void constructorParameterMetadataSimpleProperty() { process(ImmutableSimpleProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(ImmutableSimpleProperties.class); ConstructorParameterPropertyDescriptor property = createPropertyDescriptor(ownerElement, "counter"); @@ -106,7 +105,7 @@ class ConstructorParameterPropertyDescriptorTests extends PropertyDescriptorTest } @Test - void constructorParameterMetadataNestedGroup() throws IOException { + void constructorParameterMetadataNestedGroup() { process(ImmutableInnerClassProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(ImmutableInnerClassProperties.class); ConstructorParameterPropertyDescriptor property = createPropertyDescriptor(ownerElement, "first"); @@ -118,7 +117,7 @@ class ConstructorParameterPropertyDescriptorTests extends PropertyDescriptorTest } @Test - void constructorParameterDeprecatedPropertyOnGetter() throws IOException { + void constructorParameterDeprecatedPropertyOnGetter() { process(ImmutableSimpleProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(ImmutableSimpleProperties.class); ExecutableElement getter = getMethod(ownerElement, "isFlag"); @@ -131,7 +130,7 @@ class ConstructorParameterPropertyDescriptorTests extends PropertyDescriptorTest } @Test - void constructorParameterPropertyWithDescription() throws IOException { + void constructorParameterPropertyWithDescription() { process(ImmutableSimpleProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(ImmutableSimpleProperties.class); ConstructorParameterPropertyDescriptor property = createPropertyDescriptor(ownerElement, "theName"); @@ -141,7 +140,7 @@ class ConstructorParameterPropertyDescriptorTests extends PropertyDescriptorTest } @Test - void constructorParameterPropertyWithDefaultValue() throws IOException { + void constructorParameterPropertyWithDefaultValue() { process(ImmutableSimpleProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(ImmutableSimpleProperties.class); ConstructorParameterPropertyDescriptor property = createPropertyDescriptor(ownerElement, "theName"); @@ -150,7 +149,7 @@ class ConstructorParameterPropertyDescriptorTests extends PropertyDescriptorTest } @Test - void constructorParameterPropertyWithPrimitiveTypes() throws IOException { + void constructorParameterPropertyWithPrimitiveTypes() { process(ImmutablePrimitiveProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(ImmutablePrimitiveProperties.class); assertItemMetadata(metadataEnv, createPropertyDescriptor(ownerElement, "flag")).hasDefaultValue(false); @@ -166,7 +165,7 @@ class ConstructorParameterPropertyDescriptorTests extends PropertyDescriptorTest } @Test - void constructorParameterPropertyWithPrimitiveTypesAndDefaultValues() throws IOException { + void constructorParameterPropertyWithPrimitiveTypesAndDefaultValues() { process(ImmutablePrimitiveWithDefaultsProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(ImmutablePrimitiveWithDefaultsProperties.class); assertItemMetadata(metadataEnv, createPropertyDescriptor(ownerElement, "flag")).hasDefaultValue(true); @@ -183,7 +182,7 @@ class ConstructorParameterPropertyDescriptorTests extends PropertyDescriptorTest } @Test - void constructorParameterPropertyWithPrimitiveWrapperTypesAndDefaultValues() throws IOException { + void constructorParameterPropertyWithPrimitiveWrapperTypesAndDefaultValues() { process(ImmutablePrimitiveWrapperWithDefaultsProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(ImmutablePrimitiveWrapperWithDefaultsProperties.class); assertItemMetadata(metadataEnv, createPropertyDescriptor(ownerElement, "flag")).hasDefaultValue(true); @@ -200,7 +199,7 @@ class ConstructorParameterPropertyDescriptorTests extends PropertyDescriptorTest } @Test - void constructorParameterPropertyWithCollectionTypesAndDefaultValues() throws IOException { + void constructorParameterPropertyWithCollectionTypesAndDefaultValues() { process(ImmutableCollectionProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(ImmutableCollectionProperties.class); assertItemMetadata(metadataEnv, createPropertyDescriptor(ownerElement, "names")).hasDefaultValue(null); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/EndpointMetadataGenerationTests.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/EndpointMetadataGenerationTests.java index 86e810497e..83229fe49f 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/EndpointMetadataGenerationTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/EndpointMetadataGenerationTests.java @@ -96,7 +96,7 @@ class EndpointMetadataGenerationTests extends AbstractMetadataGenerationTests { } @Test - void incrementalEndpointBuildChangeGeneralEnabledFlag() throws Exception { + void incrementalEndpointBuildChangeGeneralEnabledFlag() { TestProject project = new TestProject(IncrementalEndpoint.class); ConfigurationMetadata metadata = project.compile(); assertThat(metadata) @@ -115,7 +115,7 @@ class EndpointMetadataGenerationTests extends AbstractMetadataGenerationTests { } @Test - void incrementalEndpointBuildChangeCacheFlag() throws Exception { + void incrementalEndpointBuildChangeCacheFlag() { TestProject project = new TestProject(IncrementalEndpoint.class); ConfigurationMetadata metadata = project.compile(); assertThat(metadata) @@ -132,7 +132,7 @@ class EndpointMetadataGenerationTests extends AbstractMetadataGenerationTests { } @Test - void incrementalEndpointBuildEnableSpecificEndpoint() throws Exception { + void incrementalEndpointBuildEnableSpecificEndpoint() { TestProject project = new TestProject(SpecificEndpoint.class); ConfigurationMetadata metadata = project.compile(); assertThat(metadata).has(Metadata.withGroup("management.endpoint.specific").fromSource(SpecificEndpoint.class)); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/IncrementalBuildMetadataGenerationTests.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/IncrementalBuildMetadataGenerationTests.java index d47d072841..8fd03b5357 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/IncrementalBuildMetadataGenerationTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/IncrementalBuildMetadataGenerationTests.java @@ -62,7 +62,7 @@ class IncrementalBuildMetadataGenerationTests extends AbstractMetadataGeneration } @Test - void incrementalBuildAnnotationRemoved() throws Exception { + void incrementalBuildAnnotationRemoved() { TestProject project = new TestProject(FooProperties.class, BarProperties.class); ConfigurationMetadata metadata = project.compile(); assertThat(metadata).has(Metadata.withProperty("foo.counter").withDefaultValue(0)); @@ -75,7 +75,7 @@ class IncrementalBuildMetadataGenerationTests extends AbstractMetadataGeneration @Test @Disabled("gh-26271") - void incrementalBuildTypeRenamed() throws Exception { + void incrementalBuildTypeRenamed() { TestProject project = new TestProject(FooProperties.class, BarProperties.class); ConfigurationMetadata metadata = project.compile(); assertThat(metadata) @@ -95,7 +95,7 @@ class IncrementalBuildMetadataGenerationTests extends AbstractMetadataGeneration } @Test - void incrementalBuildDoesNotDeleteItems() throws Exception { + void incrementalBuildDoesNotDeleteItems() { TestProject project = new TestProject(ClassWithNestedProperties.class, FooProperties.class); ConfigurationMetadata initialMetadata = project.compile(); ConfigurationMetadata updatedMetadata = project.compile(); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/JavaBeanPropertyDescriptorTests.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/JavaBeanPropertyDescriptorTests.java index a4ced722c7..567d8c3b4f 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/JavaBeanPropertyDescriptorTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/JavaBeanPropertyDescriptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2022 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,8 +16,6 @@ package org.springframework.boot.configurationprocessor; -import java.io.IOException; - import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; @@ -40,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests { @Test - void javaBeanSimpleProperty() throws IOException { + void javaBeanSimpleProperty() { process(SimpleTypeProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(SimpleTypeProperties.class); JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement, "myString"); @@ -54,7 +52,7 @@ class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void javaBeanCollectionProperty() throws IOException { + void javaBeanCollectionProperty() { process(SimpleCollectionProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(SimpleCollectionProperties.class); JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement, "doubles"); @@ -67,7 +65,7 @@ class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void javaBeanNestedPropertySameClass() throws IOException { + void javaBeanNestedPropertySameClass() { process(InnerClassProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(InnerClassProperties.class); JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement, "first"); @@ -80,7 +78,7 @@ class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void javaBeanNestedPropertyWithAnnotation() throws IOException { + void javaBeanNestedPropertyWithAnnotation() { process(InnerClassProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(InnerClassProperties.class); JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement, "third"); @@ -93,7 +91,7 @@ class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void javaBeanSimplePropertyWithOnlyGetterShouldNotBeExposed() throws IOException { + void javaBeanSimplePropertyWithOnlyGetterShouldNotBeExposed() { process(SimpleProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(SimpleProperties.class); ExecutableElement getter = getMethod(ownerElement, "getSize"); @@ -110,7 +108,7 @@ class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void javaBeanSimplePropertyWithOnlySetterShouldNotBeExposed() throws IOException { + void javaBeanSimplePropertyWithOnlySetterShouldNotBeExposed() { process(SimpleProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(SimpleProperties.class); VariableElement field = getField(ownerElement, "counter"); @@ -126,7 +124,7 @@ class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void javaBeanMetadataSimpleProperty() throws IOException { + void javaBeanMetadataSimpleProperty() { process(SimpleTypeProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(SimpleTypeProperties.class); JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement, "myString"); @@ -136,7 +134,7 @@ class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void javaBeanMetadataCollectionProperty() throws IOException { + void javaBeanMetadataCollectionProperty() { process(SimpleCollectionProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(SimpleCollectionProperties.class); JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement, "doubles"); @@ -147,7 +145,7 @@ class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void javaBeanMetadataNestedGroup() throws IOException { + void javaBeanMetadataNestedGroup() { process(InnerClassProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(InnerClassProperties.class); JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement, "first"); @@ -159,7 +157,7 @@ class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void javaBeanMetadataNotACandidatePropertyShouldReturnNull() throws IOException { + void javaBeanMetadataNotACandidatePropertyShouldReturnNull() { process(SimpleProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(SimpleProperties.class); VariableElement field = getField(ownerElement, "counter"); @@ -171,7 +169,7 @@ class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests { @Test @SuppressWarnings("deprecation") - void javaBeanDeprecatedPropertyOnClass() throws IOException { + void javaBeanDeprecatedPropertyOnClass() { process(org.springframework.boot.configurationsample.simple.DeprecatedProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement( @@ -182,7 +180,7 @@ class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void javaBeanMetadataDeprecatedPropertyWithAnnotation() throws IOException { + void javaBeanMetadataDeprecatedPropertyWithAnnotation() { process(DeprecatedSingleProperty.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(DeprecatedSingleProperty.class); JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement, "name"); @@ -192,7 +190,7 @@ class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void javaBeanDeprecatedPropertyOnGetter() throws IOException { + void javaBeanDeprecatedPropertyOnGetter() { process(SimpleProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(SimpleProperties.class); JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement, "flag", "isFlag", "setFlag"); @@ -201,7 +199,7 @@ class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void javaBeanDeprecatedPropertyOnSetter() throws IOException { + void javaBeanDeprecatedPropertyOnSetter() { process(SimpleProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(SimpleProperties.class); JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement, "theName"); @@ -210,7 +208,7 @@ class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void javaBeanPropertyWithDescription() throws IOException { + void javaBeanPropertyWithDescription() { process(SimpleProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(SimpleProperties.class); JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement, "theName"); @@ -220,7 +218,7 @@ class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void javaBeanPropertyWithDefaultValue() throws IOException { + void javaBeanPropertyWithDefaultValue() { process(SimpleProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(SimpleProperties.class); JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement, "theName"); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/LombokPropertyDescriptorTests.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/LombokPropertyDescriptorTests.java index 66d02ce82f..1d8d0685a3 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/LombokPropertyDescriptorTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/LombokPropertyDescriptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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,8 +16,6 @@ package org.springframework.boot.configurationprocessor; -import java.io.IOException; - import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; @@ -44,7 +42,7 @@ import static org.assertj.core.api.Assertions.assertThat; class LombokPropertyDescriptorTests extends PropertyDescriptorTests { @Test - void lombokSimpleProperty() throws IOException { + void lombokSimpleProperty() { process(LombokSimpleProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(LombokSimpleProperties.class); LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "name"); @@ -57,7 +55,7 @@ class LombokPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void lombokCollectionProperty() throws IOException { + void lombokCollectionProperty() { process(LombokSimpleProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(LombokSimpleProperties.class); LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "items"); @@ -70,7 +68,7 @@ class LombokPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void lombokNestedPropertySameClass() throws IOException { + void lombokNestedPropertySameClass() { process(LombokInnerClassProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(LombokInnerClassProperties.class); LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "first"); @@ -83,7 +81,7 @@ class LombokPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void lombokNestedPropertyWithAnnotation() throws IOException { + void lombokNestedPropertyWithAnnotation() { process(LombokInnerClassProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(LombokInnerClassProperties.class); LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "third"); @@ -96,7 +94,7 @@ class LombokPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void lombokSimplePropertyWithOnlyGetterOnClassShouldNotBeExposed() throws IOException { + void lombokSimplePropertyWithOnlyGetterOnClassShouldNotBeExposed() { process(LombokSimpleProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(LombokSimpleProperties.class); LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "ignored"); @@ -106,7 +104,7 @@ class LombokPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void lombokSimplePropertyWithOnlyGetterOnDataClassShouldNotBeExposed() throws IOException { + void lombokSimplePropertyWithOnlyGetterOnDataClassShouldNotBeExposed() { process(LombokSimpleDataProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(LombokSimpleDataProperties.class); LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "ignored"); @@ -116,7 +114,7 @@ class LombokPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void lombokSimplePropertyWithOnlyGetterOnValueClassShouldNotBeExposed() throws IOException { + void lombokSimplePropertyWithOnlyGetterOnValueClassShouldNotBeExposed() { process(LombokSimpleValueProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(LombokSimpleValueProperties.class); LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "ignored"); @@ -126,7 +124,7 @@ class LombokPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void lombokSimplePropertyWithOnlyGetterOnFieldShouldNotBeExposed() throws IOException { + void lombokSimplePropertyWithOnlyGetterOnFieldShouldNotBeExposed() { process(LombokExplicitProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(LombokExplicitProperties.class); LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "ignoredOnlyGetter"); @@ -136,7 +134,7 @@ class LombokPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void lombokSimplePropertyWithOnlySetterOnFieldShouldNotBeExposed() throws IOException { + void lombokSimplePropertyWithOnlySetterOnFieldShouldNotBeExposed() { process(LombokExplicitProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(LombokExplicitProperties.class); LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "ignoredOnlySetter"); @@ -146,7 +144,7 @@ class LombokPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void lombokMetadataSimpleProperty() throws IOException { + void lombokMetadataSimpleProperty() { process(LombokSimpleProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(LombokSimpleProperties.class); LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "description"); @@ -156,7 +154,7 @@ class LombokPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void lombokMetadataCollectionProperty() throws IOException { + void lombokMetadataCollectionProperty() { process(LombokSimpleProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(LombokSimpleProperties.class); LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "items"); @@ -167,7 +165,7 @@ class LombokPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void lombokMetadataNestedGroup() throws IOException { + void lombokMetadataNestedGroup() { process(LombokInnerClassProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(LombokInnerClassProperties.class); VariableElement field = getField(ownerElement, "third"); @@ -182,7 +180,7 @@ class LombokPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void lombokMetadataNestedGroupNoGetter() throws IOException { + void lombokMetadataNestedGroupNoGetter() { process(LombokInnerClassProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(LombokInnerClassProperties.class); LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "first"); @@ -194,7 +192,7 @@ class LombokPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void lombokMetadataNotACandidatePropertyShouldReturnNull() throws IOException { + void lombokMetadataNotACandidatePropertyShouldReturnNull() { process(LombokSimpleProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(LombokSimpleProperties.class); LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "ignored"); @@ -204,7 +202,7 @@ class LombokPropertyDescriptorTests extends PropertyDescriptorTests { @Test @SuppressWarnings("deprecation") - void lombokDeprecatedPropertyOnClass() throws IOException { + void lombokDeprecatedPropertyOnClass() { process(org.springframework.boot.configurationsample.lombok.LombokDeprecatedProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement( @@ -215,7 +213,7 @@ class LombokPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void lombokDeprecatedPropertyOnField() throws IOException { + void lombokDeprecatedPropertyOnField() { process(LombokDeprecatedSingleProperty.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(LombokDeprecatedSingleProperty.class); LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "name"); @@ -224,7 +222,7 @@ class LombokPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void lombokPropertyWithDescription() throws IOException { + void lombokPropertyWithDescription() { process(LombokSimpleProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(LombokSimpleProperties.class); LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "name"); @@ -233,7 +231,7 @@ class LombokPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void lombokPropertyWithDefaultValue() throws IOException { + void lombokPropertyWithDefaultValue() { process(LombokDefaultValueProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(LombokDefaultValueProperties.class); LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "description"); @@ -242,7 +240,7 @@ class LombokPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void lombokPropertyNotCandidate() throws IOException { + void lombokPropertyNotCandidate() { process(SimpleProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(SimpleProperties.class); LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "theName"); @@ -252,7 +250,7 @@ class LombokPropertyDescriptorTests extends PropertyDescriptorTests { } @Test - void lombokNestedPropertyNotCandidate() throws IOException { + void lombokNestedPropertyNotCandidate() { process(InnerClassProperties.class, (roundEnv, metadataEnv) -> { TypeElement ownerElement = roundEnv.getRootElement(InnerClassProperties.class); LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "first"); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/MergeMetadataGenerationTests.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/MergeMetadataGenerationTests.java index cdeb4636f8..72b3d7fd05 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/MergeMetadataGenerationTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/MergeMetadataGenerationTests.java @@ -16,7 +16,6 @@ package org.springframework.boot.configurationprocessor; -import java.io.IOException; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -149,7 +148,7 @@ class MergeMetadataGenerationTests extends AbstractMetadataGenerationTests { } @Test - void mergeOfInvalidAdditionalMetadata() throws IOException { + void mergeOfInvalidAdditionalMetadata() { String metadata = "Hello World"; assertThatExceptionOfType(CompilationException.class) .isThrownBy(() -> compile(metadata, SimpleProperties.class)) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/PropertyDescriptorResolverTests.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/PropertyDescriptorResolverTests.java index 977c20e039..9ac221e0ed 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/PropertyDescriptorResolverTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/PropertyDescriptorResolverTests.java @@ -16,7 +16,6 @@ package org.springframework.boot.configurationprocessor; -import java.io.IOException; import java.util.Arrays; import java.util.Collection; import java.util.Collections; @@ -32,7 +31,6 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.configurationprocessor.metadata.ItemMetadata; import org.springframework.boot.configurationprocessor.test.RoundEnvironmentTester; import org.springframework.boot.configurationprocessor.test.TestableAnnotationProcessor; -import org.springframework.boot.configurationsample.immutable.DeprecatedImmutableMultiConstructorProperties; import org.springframework.boot.configurationsample.immutable.ImmutableClassConstructorBindingProperties; import org.springframework.boot.configurationsample.immutable.ImmutableDeducedConstructorBindingProperties; import org.springframework.boot.configurationsample.immutable.ImmutableMultiConstructorProperties; @@ -62,13 +60,13 @@ import static org.assertj.core.api.Assertions.assertThat; class PropertyDescriptorResolverTests { @Test - void propertiesWithJavaBeanProperties() throws IOException { + void propertiesWithJavaBeanProperties() { process(SimpleProperties.class, propertyNames((stream) -> assertThat(stream).containsExactly("theName", "flag", "comparator"))); } @Test - void propertiesWithJavaBeanHierarchicalProperties() throws IOException { + void propertiesWithJavaBeanHierarchicalProperties() { process(HierarchicalProperties.class, Arrays.asList(HierarchicalPropertiesParent.class, HierarchicalPropertiesGrandparent.class), (type, metadataEnv) -> { @@ -86,31 +84,31 @@ class PropertyDescriptorResolverTests { } @Test - void propertiesWithLombokGetterSetterAtClassLevel() throws IOException { + void propertiesWithLombokGetterSetterAtClassLevel() { process(LombokSimpleProperties.class, propertyNames( (stream) -> assertThat(stream).containsExactly("name", "description", "counter", "number", "items"))); } @Test - void propertiesWithLombokGetterSetterAtFieldLevel() throws IOException { + void propertiesWithLombokGetterSetterAtFieldLevel() { process(LombokExplicitProperties.class, propertyNames( (stream) -> assertThat(stream).containsExactly("name", "description", "counter", "number", "items"))); } @Test - void propertiesWithLombokDataClass() throws IOException { + void propertiesWithLombokDataClass() { process(LombokSimpleDataProperties.class, propertyNames( (stream) -> assertThat(stream).containsExactly("name", "description", "counter", "number", "items"))); } @Test - void propertiesWithLombokValueClass() throws IOException { + void propertiesWithLombokValueClass() { process(LombokSimpleValueProperties.class, propertyNames( (stream) -> assertThat(stream).containsExactly("name", "description", "counter", "number", "items"))); } @Test - void propertiesWithDeducedConstructorBinding() throws IOException { + void propertiesWithDeducedConstructorBinding() { process(ImmutableDeducedConstructorBindingProperties.class, propertyNames((stream) -> assertThat(stream).containsExactly("theName", "flag"))); process(ImmutableDeducedConstructorBindingProperties.class, properties((stream) -> assertThat(stream) @@ -118,7 +116,7 @@ class PropertyDescriptorResolverTests { } @Test - void propertiesWithConstructorWithConstructorBinding() throws IOException { + void propertiesWithConstructorWithConstructorBinding() { process(ImmutableSimpleProperties.class, propertyNames( (stream) -> assertThat(stream).containsExactly("theName", "flag", "comparator", "counter"))); process(ImmutableSimpleProperties.class, properties((stream) -> assertThat(stream) @@ -126,7 +124,7 @@ class PropertyDescriptorResolverTests { } @Test - void propertiesWithConstructorAndClassConstructorBinding() throws IOException { + void propertiesWithConstructorAndClassConstructorBinding() { process(ImmutableClassConstructorBindingProperties.class, propertyNames((stream) -> assertThat(stream).containsExactly("name", "description"))); process(ImmutableClassConstructorBindingProperties.class, properties((stream) -> assertThat(stream) @@ -134,14 +132,14 @@ class PropertyDescriptorResolverTests { } @Test - void propertiesWithAutowiredConstructor() throws IOException { + void propertiesWithAutowiredConstructor() { process(AutowiredProperties.class, propertyNames((stream) -> assertThat(stream).containsExactly("theName"))); process(AutowiredProperties.class, properties((stream) -> assertThat(stream) .allMatch((predicate) -> predicate instanceof JavaBeanPropertyDescriptor))); } @Test - void propertiesWithMultiConstructor() throws IOException { + void propertiesWithMultiConstructor() { process(ImmutableMultiConstructorProperties.class, propertyNames((stream) -> assertThat(stream).containsExactly("name", "description"))); process(ImmutableMultiConstructorProperties.class, properties((stream) -> assertThat(stream) @@ -151,22 +149,23 @@ class PropertyDescriptorResolverTests { @Test @Deprecated(since = "3.0.0", forRemoval = true) @SuppressWarnings("removal") - void propertiesWithMultiConstructorAndDeprecatedAnnotation() throws IOException { - process(DeprecatedImmutableMultiConstructorProperties.class, + void propertiesWithMultiConstructorAndDeprecatedAnnotation() { + process(org.springframework.boot.configurationsample.immutable.DeprecatedImmutableMultiConstructorProperties.class, propertyNames((stream) -> assertThat(stream).containsExactly("name", "description"))); - process(DeprecatedImmutableMultiConstructorProperties.class, properties((stream) -> assertThat(stream) - .allMatch((predicate) -> predicate instanceof ConstructorParameterPropertyDescriptor))); + process(org.springframework.boot.configurationsample.immutable.DeprecatedImmutableMultiConstructorProperties.class, + properties((stream) -> assertThat(stream) + .allMatch((predicate) -> predicate instanceof ConstructorParameterPropertyDescriptor))); } @Test - void propertiesWithMultiConstructorNoDirective() throws IOException { + void propertiesWithMultiConstructorNoDirective() { process(TwoConstructorsExample.class, propertyNames((stream) -> assertThat(stream).containsExactly("name"))); process(TwoConstructorsExample.class, properties((stream) -> assertThat(stream).element(0).isInstanceOf(JavaBeanPropertyDescriptor.class))); } @Test - void propertiesWithNameAnnotationParameter() throws IOException { + void propertiesWithNameAnnotationParameter() { process(ImmutableNameAnnotationProperties.class, propertyNames((stream) -> assertThat(stream).containsExactly("import"))); } @@ -183,8 +182,7 @@ class PropertyDescriptorResolverTests { return properties((result) -> stream.accept(result.map(PropertyDescriptor::getName))); } - private void process(Class target, BiConsumer consumer) - throws IOException { + private void process(Class target, BiConsumer consumer) { process(target, Collections.emptyList(), consumer); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TypeUtilsTests.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TypeUtilsTests.java index 4686bfec26..759c030b7d 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TypeUtilsTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/TypeUtilsTests.java @@ -16,7 +16,6 @@ package org.springframework.boot.configurationprocessor; -import java.io.IOException; import java.time.Duration; import java.util.function.BiConsumer; @@ -42,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat; class TypeUtilsTests { @Test - void resolveTypeDescriptorOnConcreteClass() throws IOException { + void resolveTypeDescriptorOnConcreteClass() { process(SimpleGenericProperties.class, (roundEnv, typeUtils) -> { TypeDescriptor typeDescriptor = typeUtils .resolveTypeDescriptor(roundEnv.getRootElement(SimpleGenericProperties.class)); @@ -56,7 +55,7 @@ class TypeUtilsTests { } @Test - void resolveTypeDescriptorOnIntermediateClass() throws IOException { + void resolveTypeDescriptorOnIntermediateClass() { process(AbstractIntermediateGenericProperties.class, (roundEnv, typeUtils) -> { TypeDescriptor typeDescriptor = typeUtils .resolveTypeDescriptor(roundEnv.getRootElement(AbstractIntermediateGenericProperties.class)); @@ -69,7 +68,7 @@ class TypeUtilsTests { } @Test - void resolveTypeDescriptorWithOnlyGenerics() throws IOException { + void resolveTypeDescriptorWithOnlyGenerics() { process(AbstractGenericProperties.class, (roundEnv, typeUtils) -> { TypeDescriptor typeDescriptor = typeUtils .resolveTypeDescriptor(roundEnv.getRootElement(AbstractGenericProperties.class)); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackRuntimeHintsTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackRuntimeHintsTests.java index f541788e48..eac9914fa6 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackRuntimeHintsTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackRuntimeHintsTests.java @@ -16,7 +16,6 @@ package org.springframework.boot.logging.logback; -import java.io.IOException; import java.util.List; import java.util.function.Consumer; @@ -49,7 +48,7 @@ class LogbackRuntimeHintsTests { } @Test - void registersHintsForBuiltInLogbackConverters() throws Exception { + void registersHintsForBuiltInLogbackConverters() { ReflectionHints reflection = registerHints(); assertThat(logbackConverters()).allSatisfy(registeredForPublicConstructorInvocation(reflection)); } @@ -84,7 +83,7 @@ class LogbackRuntimeHintsTests { }; } - private List> logbackConverters() throws IOException { + private List> logbackConverters() { return List.of(DateTokenConverter.class, IntegerTokenConverter.class, SyslogStartConverter.class); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/SpringProfileModelHandlerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/SpringProfileModelHandlerTests.java index d76fec4e6e..ac87166838 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/SpringProfileModelHandlerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/logback/SpringProfileModelHandlerTests.java @@ -21,7 +21,6 @@ import java.util.List; import ch.qos.logback.core.Context; import ch.qos.logback.core.ContextBase; -import ch.qos.logback.core.joran.spi.ActionException; import ch.qos.logback.core.model.processor.ModelHandlerException; import ch.qos.logback.core.model.processor.ModelInterpretationContext; import org.junit.jupiter.api.BeforeEach; @@ -56,7 +55,7 @@ class SpringProfileModelHandlerTests { } @Test - void environmentIsQueriedWithProfileFromModelName() throws ActionException, ModelHandlerException { + void environmentIsQueriedWithProfileFromModelName() throws ModelHandlerException { SpringProfileModel model = new SpringProfileModel(); model.setName("dev"); this.action.handle(this.interpretationContext, model); diff --git a/spring-boot-system-tests/spring-boot-image-tests/src/systemTest/java/org/springframework/boot/image/paketo/PaketoBuilderTests.java b/spring-boot-system-tests/spring-boot-image-tests/src/systemTest/java/org/springframework/boot/image/paketo/PaketoBuilderTests.java index f0cf2d4d57..4202889cc3 100644 --- a/spring-boot-system-tests/spring-boot-image-tests/src/systemTest/java/org/springframework/boot/image/paketo/PaketoBuilderTests.java +++ b/spring-boot-system-tests/spring-boot-image-tests/src/systemTest/java/org/springframework/boot/image/paketo/PaketoBuilderTests.java @@ -68,7 +68,7 @@ class PaketoBuilderTests { GradleBuild gradleBuild; @BeforeEach - void configureGradleBuild() throws IOException { + void configureGradleBuild() { this.gradleBuild.scriptProperty("systemTestMavenRepository", new File("build/system-test-maven-repository").getAbsoluteFile().toURI().toASCIIString()); this.gradleBuild.scriptPropertyFrom(new File("../../gradle.properties"), "nativeBuildToolsVersion"); diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-session-mongo/src/test/java/smoketest/session/mongodb/SampleSessionMongoApplicationTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-session-mongo/src/test/java/smoketest/session/mongodb/SampleSessionMongoApplicationTests.java index 997d5a9e35..38bd1c6a01 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-session-mongo/src/test/java/smoketest/session/mongodb/SampleSessionMongoApplicationTests.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-session-mongo/src/test/java/smoketest/session/mongodb/SampleSessionMongoApplicationTests.java @@ -83,7 +83,6 @@ public class SampleSessionMongoApplicationTests { } @Test - @SuppressWarnings("unchecked") void health() { ResponseEntity entity = this.restTemplate .getForEntity("http://localhost:" + this.port + "/actuator/health", String.class); @@ -111,7 +110,7 @@ public class SampleSessionMongoApplicationTests { private ResponseEntity> getSessions() { RequestEntity request = getRequestEntity(URI.create("/actuator/sessions?username=user")); - ParameterizedTypeReference> stringObjectMap = new ParameterizedTypeReference>() { + ParameterizedTypeReference> stringObjectMap = new ParameterizedTypeReference<>() { }; return this.restTemplate.exchange(request, stringObjectMap); }