Skip to content

Commit d216474

Browse files
Merge branch '3.2.x'
Closes gh-39387
2 parents 550651f + cff9d46 commit d216474

15 files changed

+52
-91
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/AuditEventsEndpointDocumentationTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,8 +18,8 @@
1818

1919
import java.time.OffsetDateTime;
2020
import java.time.format.DateTimeFormatter;
21-
import java.util.Arrays;
2221
import java.util.Collections;
22+
import java.util.List;
2323

2424
import org.junit.jupiter.api.Test;
2525

@@ -56,7 +56,7 @@ class AuditEventsEndpointDocumentationTests extends MockMvcEndpointDocumentation
5656
void allAuditEvents() throws Exception {
5757
String queryTimestamp = "2017-11-07T09:37Z";
5858
given(this.repository.find(any(), any(), any()))
59-
.willReturn(Arrays.asList(new AuditEvent("alice", "logout", Collections.emptyMap())));
59+
.willReturn(List.of(new AuditEvent("alice", "logout", Collections.emptyMap())));
6060
this.mockMvc.perform(get("/actuator/auditevents").param("after", queryTimestamp))
6161
.andExpect(status().isOk())
6262
.andDo(document("auditevents/all",
@@ -72,7 +72,7 @@ void filteredAuditEvents() throws Exception {
7272
OffsetDateTime now = OffsetDateTime.now();
7373
String queryTimestamp = DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(now);
7474
given(this.repository.find("alice", now.toInstant(), "logout"))
75-
.willReturn(Arrays.asList(new AuditEvent("alice", "logout", Collections.emptyMap())));
75+
.willReturn(List.of(new AuditEvent("alice", "logout", Collections.emptyMap())));
7676
this.mockMvc
7777
.perform(get("/actuator/auditevents").param("principal", "alice")
7878
.param("after", queryTimestamp)

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/BeansEndpointDocumentationTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
1616

1717
package org.springframework.boot.actuate.autoconfigure.endpoint.web.documentation;
1818

19-
import java.util.Arrays;
2019
import java.util.Collection;
2120
import java.util.List;
2221
import java.util.Map;
@@ -50,7 +49,7 @@ class BeansEndpointDocumentationTests extends MockMvcEndpointDocumentationTests
5049

5150
@Test
5251
void beans() throws Exception {
53-
List<FieldDescriptor> beanFields = Arrays.asList(fieldWithPath("aliases").description("Names of any aliases."),
52+
List<FieldDescriptor> beanFields = List.of(fieldWithPath("aliases").description("Names of any aliases."),
5453
fieldWithPath("scope").description("Scope of the bean."),
5554
fieldWithPath("type").description("Fully qualified type of the bean."),
5655
fieldWithPath("resource").description("Resource in which the bean was defined, if any.")

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/CachesEndpointDocumentationTests.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
1616

1717
package org.springframework.boot.actuate.autoconfigure.endpoint.web.documentation;
1818

19-
import java.util.Arrays;
2019
import java.util.Collections;
2120
import java.util.HashMap;
2221
import java.util.List;
@@ -50,8 +49,7 @@
5049
*/
5150
class CachesEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
5251

53-
private static final List<FieldDescriptor> levelFields = Arrays.asList(
54-
fieldWithPath("name").description("Cache name."),
52+
private static final List<FieldDescriptor> levelFields = List.of(fieldWithPath("name").description("Cache name."),
5553
fieldWithPath("cacheManager").description("Cache manager name."),
5654
fieldWithPath("target").description("Fully qualified name of the native cache."));
5755

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/ConditionsReportEndpointDocumentationTests.java

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,27 +16,20 @@
1616

1717
package org.springframework.boot.actuate.autoconfigure.endpoint.web.documentation;
1818

19-
import java.util.Arrays;
2019
import java.util.List;
2120

22-
import org.junit.jupiter.api.BeforeEach;
2321
import org.junit.jupiter.api.Test;
2422

25-
import org.springframework.beans.factory.annotation.Autowired;
2623
import org.springframework.boot.actuate.autoconfigure.condition.ConditionsReportEndpoint;
2724
import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport;
2825
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
2926
import org.springframework.context.ConfigurableApplicationContext;
3027
import org.springframework.context.annotation.Bean;
3128
import org.springframework.context.annotation.Configuration;
3229
import org.springframework.context.annotation.Import;
33-
import org.springframework.restdocs.RestDocumentationContextProvider;
3430
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
3531
import org.springframework.restdocs.payload.FieldDescriptor;
3632
import org.springframework.restdocs.payload.JsonFieldType;
37-
import org.springframework.test.web.servlet.MockMvc;
38-
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
39-
import org.springframework.web.context.WebApplicationContext;
4033

4134
import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
4235
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
@@ -51,26 +44,13 @@
5144
*/
5245
class ConditionsReportEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
5346

54-
private MockMvc mockMvc;
55-
56-
@Autowired
57-
private WebApplicationContext applicationContext;
58-
59-
@Override
60-
@BeforeEach
61-
void setup(RestDocumentationContextProvider restDocumentation) {
62-
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.applicationContext)
63-
.apply(MockMvcRestDocumentation.documentationConfiguration(restDocumentation).uris())
64-
.build();
65-
}
66-
6747
@Test
6848
void conditions() throws Exception {
69-
List<FieldDescriptor> positiveMatchFields = Arrays.asList(
49+
List<FieldDescriptor> positiveMatchFields = List.of(
7050
fieldWithPath("").description("Classes and methods with conditions that were matched."),
7151
fieldWithPath(".*.[].condition").description("Name of the condition."),
7252
fieldWithPath(".*.[].message").description("Details of why the condition was matched."));
73-
List<FieldDescriptor> negativeMatchFields = Arrays.asList(
53+
List<FieldDescriptor> negativeMatchFields = List.of(
7454
fieldWithPath("").description("Classes and methods with conditions that were not matched."),
7555
fieldWithPath(".*.notMatched").description("Conditions that were matched."),
7656
fieldWithPath(".*.notMatched.[].condition").description("Name of the condition."),
@@ -104,7 +84,7 @@ ConditionsReportEndpoint autoConfigurationReportEndpoint(ConfigurableApplication
10484
ConditionEvaluationReport conditionEvaluationReport = ConditionEvaluationReport
10585
.get(context.getBeanFactory());
10686
conditionEvaluationReport
107-
.recordEvaluationCandidates(Arrays.asList(PropertyPlaceholderAutoConfiguration.class.getName()));
87+
.recordEvaluationCandidates(List.of(PropertyPlaceholderAutoConfiguration.class.getName()));
10888
return new ConditionsReportEndpoint(context);
10989
}
11090

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/FlywayEndpointDocumentationTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
1616

1717
package org.springframework.boot.actuate.autoconfigure.endpoint.web.documentation;
1818

19-
import java.util.Arrays;
2019
import java.util.List;
2120

2221
import javax.sql.DataSource;
@@ -61,7 +60,7 @@ void flyway() throws Exception {
6160
}
6261

6362
private List<FieldDescriptor> migrationFieldDescriptors() {
64-
return Arrays.asList(fieldWithPath("checksum").description("Checksum of the migration, if any.").optional(),
63+
return List.of(fieldWithPath("checksum").description("Checksum of the migration, if any.").optional(),
6564
fieldWithPath("description").description("Description of the migration, if any.").optional(),
6665
fieldWithPath("executionTime").description("Execution time in milliseconds of an applied migration.")
6766
.optional(),

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/HealthEndpointDocumentationTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package org.springframework.boot.actuate.autoconfigure.endpoint.web.documentation;
1818

1919
import java.io.File;
20-
import java.util.Arrays;
2120
import java.util.Collections;
2221
import java.util.LinkedHashMap;
2322
import java.util.List;
@@ -68,7 +67,7 @@
6867
*/
6968
class HealthEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
7069

71-
private static final List<FieldDescriptor> componentFields = Arrays.asList(
70+
private static final List<FieldDescriptor> componentFields = List.of(
7271
fieldWithPath("status").description("Status of a specific part of the application"),
7372
subsectionWithPath("details").description("Details of the health of a specific part of the application."));
7473

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/HttpExchangesEndpointDocumentationTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,9 +22,9 @@
2222
import java.time.Duration;
2323
import java.time.Instant;
2424
import java.time.ZoneId;
25-
import java.util.Arrays;
2625
import java.util.Collections;
2726
import java.util.EnumSet;
27+
import java.util.List;
2828
import java.util.UUID;
2929

3030
import org.junit.jupiter.api.Test;
@@ -66,19 +66,19 @@ void httpExchanges() throws Exception {
6666
given(request.getUri()).willReturn(URI.create("https://api.example.com"));
6767
given(request.getMethod()).willReturn("GET");
6868
given(request.getHeaders())
69-
.willReturn(Collections.singletonMap(HttpHeaders.ACCEPT, Arrays.asList("application/json")));
69+
.willReturn(Collections.singletonMap(HttpHeaders.ACCEPT, List.of("application/json")));
7070
RecordableHttpResponse response = mock(RecordableHttpResponse.class);
7171
given(response.getStatus()).willReturn(200);
7272
given(response.getHeaders())
73-
.willReturn(Collections.singletonMap(HttpHeaders.CONTENT_TYPE, Arrays.asList("application/json")));
73+
.willReturn(Collections.singletonMap(HttpHeaders.CONTENT_TYPE, List.of("application/json")));
7474
Principal principal = mock(Principal.class);
7575
given(principal.getName()).willReturn("alice");
7676
Instant instant = Instant.parse("2022-12-22T13:43:41.00Z");
7777
Clock start = Clock.fixed(instant, ZoneId.systemDefault());
7878
Clock end = Clock.offset(start, Duration.ofMillis(23));
7979
HttpExchange exchange = HttpExchange.start(start, request)
8080
.finish(end, response, () -> principal, () -> UUID.randomUUID().toString(), EnumSet.allOf(Include.class));
81-
given(this.repository.findAll()).willReturn(Arrays.asList(exchange));
81+
given(this.repository.findAll()).willReturn(List.of(exchange));
8282
this.mockMvc.perform(get("/actuator/httpexchanges"))
8383
.andExpect(status().isOk())
8484
.andDo(document("httpexchanges", responseFields(

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/LiquibaseEndpointDocumentationTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
1616

1717
package org.springframework.boot.actuate.autoconfigure.endpoint.web.documentation;
1818

19-
import java.util.Arrays;
2019
import java.util.List;
2120

2221
import liquibase.changelog.ChangeSet.ExecType;
@@ -59,7 +58,7 @@ void liquibase() throws Exception {
5958
}
6059

6160
private List<FieldDescriptor> getChangeSetFieldDescriptors() {
62-
return Arrays.asList(fieldWithPath("author").description("Author of the change set."),
61+
return List.of(fieldWithPath("author").description("Author of the change set."),
6362
fieldWithPath("changeLog").description("Change log that contains the change set."),
6463
fieldWithPath("comments").description("Comments on the change set."),
6564
fieldWithPath("contexts").description("Contexts of the change set."),

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/LoggersEndpointDocumentationTests.java

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
1616

1717
package org.springframework.boot.actuate.autoconfigure.endpoint.web.documentation;
1818

19-
import java.util.Arrays;
2019
import java.util.Collections;
2120
import java.util.EnumSet;
2221
import java.util.List;
@@ -55,18 +54,14 @@
5554
*/
5655
class LoggersEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
5756

58-
private static final List<FieldDescriptor> levelFields = Arrays.asList(
57+
private static final List<FieldDescriptor> levelFields = List.of(
5958
fieldWithPath("configuredLevel").description("Configured level of the logger, if any.").optional(),
6059
fieldWithPath("effectiveLevel").description("Effective level of the logger."));
6160

62-
private static final List<FieldDescriptor> groupLevelFields;
63-
64-
static {
65-
groupLevelFields = Arrays
66-
.asList(fieldWithPath("configuredLevel").description("Configured level of the logger group, if any.")
67-
.type(JsonFieldType.STRING)
68-
.optional(), fieldWithPath("members").description("Loggers that are part of this group"));
69-
}
61+
private static final List<FieldDescriptor> groupLevelFields = List
62+
.of(fieldWithPath("configuredLevel").description("Configured level of the logger group, if any.")
63+
.type(JsonFieldType.STRING)
64+
.optional(), fieldWithPath("members").description("Loggers that are part of this group"));
7065

7166
@MockBean
7267
private LoggingSystem loggingSystem;
@@ -78,7 +73,7 @@ class LoggersEndpointDocumentationTests extends MockMvcEndpointDocumentationTest
7873
void allLoggers() throws Exception {
7974
given(this.loggingSystem.getSupportedLogLevels()).willReturn(EnumSet.allOf(LogLevel.class));
8075
given(this.loggingSystem.getLoggerConfigurations())
81-
.willReturn(Arrays.asList(new LoggerConfiguration("ROOT", LogLevel.INFO, LogLevel.INFO),
76+
.willReturn(List.of(new LoggerConfiguration("ROOT", LogLevel.INFO, LogLevel.INFO),
8277
new LoggerConfiguration("com.example", LogLevel.DEBUG, LogLevel.DEBUG)));
8378
this.mockMvc.perform(get("/actuator/loggers"))
8479
.andExpect(status().isOk())
@@ -164,7 +159,7 @@ LoggersEndpoint endpoint(LoggingSystem loggingSystem, LoggerGroups groups) {
164159
}
165160

166161
private Map<String, List<String>> getLoggerGroups() {
167-
return Collections.singletonMap("test", Arrays.asList("test.member1", "test.member2"));
162+
return Collections.singletonMap("test", List.of("test.member1", "test.member2"));
168163
}
169164

170165
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/MappingsEndpointReactiveDocumentationTests.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@
1818

1919
import java.time.Duration;
2020
import java.util.ArrayList;
21-
import java.util.Arrays;
2221
import java.util.Collection;
2322
import java.util.List;
2423

@@ -81,7 +80,7 @@ void webTestClient(RestDocumentationContextProvider restDocumentation) {
8180

8281
@Test
8382
void mappings() {
84-
List<FieldDescriptor> requestMappingConditions = Arrays.asList(
83+
List<FieldDescriptor> requestMappingConditions = List.of(
8584
requestMappingConditionField("").description("Details of the request mapping conditions.").optional(),
8685
requestMappingConditionField(".consumes").description("Details of the consumes condition"),
8786
requestMappingConditionField(".consumes.[].mediaType").description("Consumed media type."),
@@ -101,7 +100,7 @@ void mappings() {
101100
requestMappingConditionField(".produces").description("Details of the produces condition."),
102101
requestMappingConditionField(".produces.[].mediaType").description("Produced media type."),
103102
requestMappingConditionField(".produces.[].negated").description("Whether the media type is negated."));
104-
List<FieldDescriptor> handlerMethod = Arrays.asList(
103+
List<FieldDescriptor> handlerMethod = List.of(
105104
fieldWithPath("*.[].details.handlerMethod").optional()
106105
.type(JsonFieldType.OBJECT)
107106
.description("Details of the method, if any, that will handle requests to this mapping."),
@@ -111,13 +110,13 @@ void mappings() {
111110
.description("Name of the method."),
112111
fieldWithPath("*.[].details.handlerMethod.descriptor").type(JsonFieldType.STRING)
113112
.description("Descriptor of the method as specified in the Java Language Specification."));
114-
List<FieldDescriptor> handlerFunction = Arrays.asList(
113+
List<FieldDescriptor> handlerFunction = List.of(
115114
fieldWithPath("*.[].details.handlerFunction").optional()
116115
.type(JsonFieldType.OBJECT)
117116
.description("Details of the function, if any, that will handle requests to this mapping."),
118117
fieldWithPath("*.[].details.handlerFunction.className").type(JsonFieldType.STRING)
119118
.description("Fully qualified name of the class of the function."));
120-
List<FieldDescriptor> dispatcherHandlerFields = new ArrayList<>(Arrays.asList(
119+
List<FieldDescriptor> dispatcherHandlerFields = new ArrayList<>(List.of(
121120
fieldWithPath("*")
122121
.description("Dispatcher handler mappings, if any, keyed by dispatcher handler bean name."),
123122
fieldWithPath("*.[].details").optional()

0 commit comments

Comments
 (0)