pull/32880/head
Andy Wilkinson 2 years ago
parent b014039a34
commit 99edda735e

@ -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<Project> {
TaskProvider<CheckSpringConfigurationMetadata> 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<RegularFile> metadataLocation = project.getTasks()
.named(mainSourceSet.getCompileJavaTaskName(), JavaCompile.class)

@ -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;

@ -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;

@ -77,7 +77,6 @@ class ConfigurationPropertiesReportEndpointAutoConfigurationTests {
}
@Test
@SuppressWarnings("unchecked")
void showValuesCanBeConfiguredViaTheEnvironment() {
this.contextRunner.withUserConfiguration(Config.class)
.withPropertyValues("management.endpoint.configprops.show-values: WHEN_AUTHORIZED")

@ -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);
});
}

@ -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()

@ -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())

@ -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";

@ -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

@ -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";

@ -210,6 +210,7 @@ class WebMvcObservationAutoConfigurationTests {
}
@Deprecated(since = "3.0.0", forRemoval = true)
private static final class TestWebMvcTagsProvider implements WebMvcTagsProvider {
@Override

@ -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);
});
}

@ -239,7 +239,6 @@ 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();
}
@ -248,12 +247,8 @@ public class JerseyEndpointResourceFactory {
.header("Content-Type", webEndpointResponse.getContentType())
.entity(convertIfNecessary(webEndpointResponse.getBody())).build();
}
catch (IOException ex) {
return Response.status(Status.INTERNAL_SERVER_ERROR).build();
}
}
private Object convertIfNecessary(Object body) throws IOException {
private Object convertIfNecessary(Object body) {
for (Function<Object, Object> converter : BODY_CONVERTERS) {
body = converter.apply(body);
}

@ -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());

@ -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<ExposableControllerEndpoint> endpoints, CorsConfiguration corsConfiguration) {
Assert.notNull(endpointMapping, "EndpointMapping must not be null");

@ -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

@ -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

@ -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

@ -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();

@ -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";

@ -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

@ -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;

@ -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));

@ -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<OAuth2TokenValidator<Jwt>> delegates) {
assertThat(delegates).hasAtLeastOneElementOfType(JwtClaimValidator.class);
OAuth2TokenValidator<Jwt> delegatingValidator = delegates.stream()

@ -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) {

@ -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);

@ -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;
/**

@ -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) -> {

@ -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);
}

@ -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) {

@ -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);

@ -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));

@ -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();

@ -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");

@ -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");

@ -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))

@ -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)
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<TypeElement, MetadataGenerationEnvironment> consumer)
throws IOException {
private void process(Class<?> target, BiConsumer<TypeElement, MetadataGenerationEnvironment> consumer) {
process(target, Collections.emptyList(), consumer);
}

@ -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));

@ -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<Class<?>> logbackConverters() throws IOException {
private List<Class<?>> logbackConverters() {
return List.of(DateTokenConverter.class, IntegerTokenConverter.class, SyslogStartConverter.class);
}

@ -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);

@ -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");

@ -83,7 +83,6 @@ public class SampleSessionMongoApplicationTests {
}
@Test
@SuppressWarnings("unchecked")
void health() {
ResponseEntity<String> entity = this.restTemplate
.getForEntity("http://localhost:" + this.port + "/actuator/health", String.class);
@ -111,7 +110,7 @@ public class SampleSessionMongoApplicationTests {
private ResponseEntity<Map<String, Object>> getSessions() {
RequestEntity<Object> request = getRequestEntity(URI.create("/actuator/sessions?username=user"));
ParameterizedTypeReference<Map<String, Object>> stringObjectMap = new ParameterizedTypeReference<Map<String, Object>>() {
ParameterizedTypeReference<Map<String, Object>> stringObjectMap = new ParameterizedTypeReference<>() {
};
return this.restTemplate.exchange(request, stringObjectMap);
}

Loading…
Cancel
Save