Skip to content

Commit 1562372

Browse files
committed
Migrate MockMvc tests to MockMvcTester
See gh-41198
1 parent e5859ae commit 1562372

File tree

77 files changed

+1047
-1236
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1047
-1236
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryActuatorAutoConfigurationTests.java

Lines changed: 4 additions & 7 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.
@@ -54,15 +54,12 @@
5454
import org.springframework.security.web.FilterChainProxy;
5555
import org.springframework.security.web.SecurityFilterChain;
5656
import org.springframework.test.util.ReflectionTestUtils;
57-
import org.springframework.test.web.servlet.MockMvc;
58-
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
57+
import org.springframework.test.web.servlet.assertj.MockMvcTester;
5958
import org.springframework.web.client.RestTemplate;
6059
import org.springframework.web.cors.CorsConfiguration;
6160
import org.springframework.web.filter.CompositeFilter;
6261

6362
import static org.assertj.core.api.Assertions.assertThat;
64-
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
65-
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
6663

6764
/**
6865
* Tests for {@link CloudFoundryActuatorAutoConfiguration}.
@@ -109,8 +106,8 @@ void cloudfoundryapplicationProducesActuatorMediaType() {
109106
.withPropertyValues("VCAP_APPLICATION:---", "vcap.application.application_id:my-app-id",
110107
"vcap.application.cf_api:https://my-cloud-controller.com")
111108
.run((context) -> {
112-
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(context).build();
113-
mockMvc.perform(get("/cloudfoundryapplication")).andExpect(header().string("Content-Type", V3_JSON));
109+
MockMvcTester mvc = MockMvcTester.from(context);
110+
assertThat(mvc.get().uri("/cloudfoundryapplication")).hasHeader("Content-Type", V3_JSON);
114111
});
115112
}
116113

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

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.springframework.context.annotation.Configuration;
3232
import org.springframework.context.annotation.Import;
3333

34+
import static org.assertj.core.api.Assertions.assertThat;
3435
import static org.mockito.ArgumentMatchers.any;
3536
import static org.mockito.BDDMockito.given;
3637
import static org.mockito.BDDMockito.then;
@@ -39,8 +40,6 @@
3940
import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
4041
import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName;
4142
import static org.springframework.restdocs.request.RequestDocumentation.queryParameters;
42-
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
43-
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
4443

4544
/**
4645
* Tests for generating documentation describing {@link AuditEventsEndpoint}.
@@ -53,13 +52,12 @@ class AuditEventsEndpointDocumentationTests extends MockMvcEndpointDocumentation
5352
private AuditEventRepository repository;
5453

5554
@Test
56-
void allAuditEvents() throws Exception {
55+
void allAuditEvents() {
5756
String queryTimestamp = "2017-11-07T09:37Z";
5857
given(this.repository.find(any(), any(), any()))
5958
.willReturn(List.of(new AuditEvent("alice", "logout", Collections.emptyMap())));
60-
this.mockMvc.perform(get("/actuator/auditevents").param("after", queryTimestamp))
61-
.andExpect(status().isOk())
62-
.andDo(document("auditevents/all",
59+
assertThat(this.mvc.get().uri("/actuator/auditevents").param("after", queryTimestamp)).hasStatusOk()
60+
.apply(document("auditevents/all",
6361
responseFields(fieldWithPath("events").description("An array of audit events."),
6462
fieldWithPath("events.[].timestamp")
6563
.description("The timestamp of when the event occurred."),
@@ -68,17 +66,18 @@ void allAuditEvents() throws Exception {
6866
}
6967

7068
@Test
71-
void filteredAuditEvents() throws Exception {
69+
void filteredAuditEvents() {
7270
OffsetDateTime now = OffsetDateTime.now();
7371
String queryTimestamp = DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(now);
7472
given(this.repository.find("alice", now.toInstant(), "logout"))
7573
.willReturn(List.of(new AuditEvent("alice", "logout", Collections.emptyMap())));
76-
this.mockMvc
77-
.perform(get("/actuator/auditevents").param("principal", "alice")
78-
.param("after", queryTimestamp)
79-
.param("type", "logout"))
80-
.andExpect(status().isOk())
81-
.andDo(document("auditevents/filtered",
74+
assertThat(this.mvc.get()
75+
.uri("/actuator/auditevents")
76+
.param("principal", "alice")
77+
.param("after", queryTimestamp)
78+
.param("type", "logout"))
79+
.hasStatusOk()
80+
.apply(document("auditevents/filtered",
8281
queryParameters(
8382
parameterWithName("after").description(
8483
"Restricts the events to those that occurred after the given time. Optional."),

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,11 @@
3333
import org.springframework.restdocs.payload.ResponseFieldsSnippet;
3434
import org.springframework.util.CollectionUtils;
3535

36+
import static org.assertj.core.api.Assertions.assertThat;
3637
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
3738
import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
3839
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
3940
import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
40-
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
41-
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
4241

4342
/**
4443
* Tests for generating documentation describing {@link BeansEndpoint}.
@@ -48,7 +47,7 @@
4847
class BeansEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
4948

5049
@Test
51-
void beans() throws Exception {
50+
void beans() {
5251
List<FieldDescriptor> beanFields = List.of(fieldWithPath("aliases").description("Names of any aliases."),
5352
fieldWithPath("scope").description("Scope of the bean."),
5453
fieldWithPath("type").description("Fully qualified type of the bean."),
@@ -60,9 +59,8 @@ void beans() throws Exception {
6059
fieldWithPath("contexts").description("Application contexts keyed by id."), parentIdField(),
6160
fieldWithPath("contexts.*.beans").description("Beans in the application context keyed by name."))
6261
.andWithPrefix("contexts.*.beans.*.", beanFields);
63-
this.mockMvc.perform(get("/actuator/beans"))
64-
.andExpect(status().isOk())
65-
.andDo(document("beans",
62+
assertThat(this.mvc.get().uri("/actuator/beans")).hasStatusOk()
63+
.apply(document("beans",
6664
preprocessResponse(
6765
limit(this::isIndependentBean, "contexts", getApplicationContext().getId(), "beans")),
6866
responseFields));

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

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,16 @@
3030
import org.springframework.context.annotation.Bean;
3131
import org.springframework.context.annotation.Configuration;
3232
import org.springframework.context.annotation.Import;
33+
import org.springframework.http.HttpStatus;
3334
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
3435
import org.springframework.restdocs.payload.FieldDescriptor;
3536
import org.springframework.restdocs.request.ParameterDescriptor;
3637

38+
import static org.assertj.core.api.Assertions.assertThat;
3739
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
3840
import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
3941
import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName;
4042
import static org.springframework.restdocs.request.RequestDocumentation.queryParameters;
41-
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete;
42-
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
43-
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
4443

4544
/**
4645
* Tests for generating documentation describing the {@link CachesEndpoint}
@@ -59,10 +58,9 @@ class CachesEndpointDocumentationTests extends MockMvcEndpointDocumentationTests
5958
.optional());
6059

6160
@Test
62-
void allCaches() throws Exception {
63-
this.mockMvc.perform(get("/actuator/caches"))
64-
.andExpect(status().isOk())
65-
.andDo(MockMvcRestDocumentation.document("caches/all",
61+
void allCaches() {
62+
assertThat(this.mvc.get().uri("/actuator/caches")).hasStatusOk()
63+
.apply(MockMvcRestDocumentation.document("caches/all",
6664
responseFields(fieldWithPath("cacheManagers").description("Cache managers keyed by id."),
6765
fieldWithPath("cacheManagers.*.caches")
6866
.description("Caches in the application context keyed by name."))
@@ -71,25 +69,23 @@ void allCaches() throws Exception {
7169
}
7270

7371
@Test
74-
void namedCache() throws Exception {
75-
this.mockMvc.perform(get("/actuator/caches/cities"))
76-
.andExpect(status().isOk())
77-
.andDo(MockMvcRestDocumentation.document("caches/named", queryParameters(queryParameters),
72+
void namedCache() {
73+
assertThat(this.mvc.get().uri("/actuator/caches/cities")).hasStatusOk()
74+
.apply(MockMvcRestDocumentation.document("caches/named", queryParameters(queryParameters),
7875
responseFields(levelFields)));
7976
}
8077

8178
@Test
82-
void evictAllCaches() throws Exception {
83-
this.mockMvc.perform(delete("/actuator/caches"))
84-
.andExpect(status().isNoContent())
85-
.andDo(MockMvcRestDocumentation.document("caches/evict-all"));
79+
void evictAllCaches() {
80+
assertThat(this.mvc.delete().uri("/actuator/caches")).hasStatus(HttpStatus.NO_CONTENT)
81+
.apply(MockMvcRestDocumentation.document("caches/evict-all"));
8682
}
8783

8884
@Test
89-
void evictNamedCache() throws Exception {
90-
this.mockMvc.perform(delete("/actuator/caches/countries?cacheManager=anotherCacheManager"))
91-
.andExpect(status().isNoContent())
92-
.andDo(MockMvcRestDocumentation.document("caches/evict-named", queryParameters(queryParameters)));
85+
void evictNamedCache() {
86+
assertThat(this.mvc.delete().uri("/actuator/caches/countries?cacheManager=anotherCacheManager"))
87+
.hasStatus(HttpStatus.NO_CONTENT)
88+
.apply(MockMvcRestDocumentation.document("caches/evict-named", queryParameters(queryParameters)));
9389
}
9490

9591
@Configuration(proxyBeanMethods = false)

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,10 @@
3131
import org.springframework.restdocs.payload.FieldDescriptor;
3232
import org.springframework.restdocs.payload.JsonFieldType;
3333

34+
import static org.assertj.core.api.Assertions.assertThat;
3435
import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
3536
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
3637
import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
37-
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
38-
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
3938

4039
/**
4140
* Tests for generating documentation describing {@link ConditionsReportEndpoint}.
@@ -64,9 +63,8 @@ void conditions() throws Exception {
6463
.optional());
6564
FieldDescriptor unconditionalClassesField = fieldWithPath("contexts.*.unconditionalClasses")
6665
.description("Names of unconditional auto-configuration classes if any.");
67-
this.mockMvc.perform(get("/actuator/conditions"))
68-
.andExpect(status().isOk())
69-
.andDo(MockMvcRestDocumentation.document("conditions",
66+
assertThat(this.mvc.get().uri("/actuator/conditions")).hasStatusOk()
67+
.apply(MockMvcRestDocumentation.document("conditions",
7068
preprocessResponse(limit("contexts", getApplicationContext().getId(), "positiveMatches"),
7169
limit("contexts", getApplicationContext().getId(), "negativeMatches")),
7270
responseFields(fieldWithPath("contexts").description("Application contexts keyed by id."))

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

Lines changed: 8 additions & 11 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.
@@ -27,12 +27,11 @@
2727
import org.springframework.context.annotation.Import;
2828
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
2929

30+
import static org.assertj.core.api.Assertions.assertThat;
3031
import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
3132
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
3233
import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
3334
import static org.springframework.restdocs.payload.PayloadDocumentation.subsectionWithPath;
34-
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
35-
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
3635

3736
/**
3837
* Tests for generating documentation describing
@@ -44,10 +43,9 @@
4443
class ConfigurationPropertiesReportEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
4544

4645
@Test
47-
void configProps() throws Exception {
48-
this.mockMvc.perform(get("/actuator/configprops"))
49-
.andExpect(status().isOk())
50-
.andDo(MockMvcRestDocumentation.document("configprops/all",
46+
void configProps() {
47+
assertThat(this.mvc.get().uri("/actuator/configprops")).hasStatusOk()
48+
.apply(MockMvcRestDocumentation.document("configprops/all",
5149
preprocessResponse(limit("contexts", getApplicationContext().getId(), "beans")),
5250
responseFields(fieldWithPath("contexts").description("Application contexts keyed by id."),
5351
fieldWithPath("contexts.*.beans.*")
@@ -62,10 +60,9 @@ void configProps() throws Exception {
6260
}
6361

6462
@Test
65-
void configPropsFilterByPrefix() throws Exception {
66-
this.mockMvc.perform(get("/actuator/configprops/spring.jackson"))
67-
.andExpect(status().isOk())
68-
.andDo(MockMvcRestDocumentation.document("configprops/prefixed",
63+
void configPropsFilterByPrefix() {
64+
assertThat(this.mvc.get().uri("/actuator/configprops/spring.jackson")).hasStatusOk()
65+
.apply(MockMvcRestDocumentation.document("configprops/prefixed",
6966
preprocessResponse(limit("contexts", getApplicationContext().getId(), "beans")),
7067
responseFields(fieldWithPath("contexts").description("Application contexts keyed by id."),
7168
fieldWithPath("contexts.*.beans.*")

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

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,12 @@
4444
import org.springframework.restdocs.payload.FieldDescriptor;
4545
import org.springframework.test.context.TestPropertySource;
4646

47+
import static org.assertj.core.api.Assertions.assertThat;
4748
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
4849
import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
4950
import static org.springframework.restdocs.operation.preprocess.Preprocessors.replacePattern;
5051
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
5152
import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
52-
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
53-
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
5453

5554
/**
5655
* Tests for generating documentation describing the {@link EnvironmentEndpoint}.
@@ -74,10 +73,9 @@ class EnvironmentEndpointDocumentationTests extends MockMvcEndpointDocumentation
7473
.description("Name of the property source.");
7574

7675
@Test
77-
void env() throws Exception {
78-
this.mockMvc.perform(get("/actuator/env"))
79-
.andExpect(status().isOk())
80-
.andDo(document("env/all",
76+
void env() {
77+
assertThat(this.mvc.get().uri("/actuator/env")).hasStatusOk()
78+
.apply(document("env/all",
8179
preprocessResponse(
8280
replacePattern(Pattern.compile(
8381
"org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/"), ""),
@@ -93,10 +91,9 @@ void env() throws Exception {
9391
}
9492

9593
@Test
96-
void singlePropertyFromEnv() throws Exception {
97-
this.mockMvc.perform(get("/actuator/env/com.example.cache.max-size"))
98-
.andExpect(status().isOk())
99-
.andDo(document("env/single",
94+
void singlePropertyFromEnv() {
95+
assertThat(this.mvc.get().uri("/actuator/env/com.example.cache.max-size")).hasStatusOk()
96+
.apply(document("env/single",
10097
preprocessResponse(replacePattern(Pattern
10198
.compile("org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/"), "")),
10299
responseFields(

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@
3535
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
3636
import org.springframework.restdocs.payload.FieldDescriptor;
3737

38+
import static org.assertj.core.api.Assertions.assertThat;
3839
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
3940
import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
40-
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
41-
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
4241

4342
/**
4443
* Tests for generating documentation describing the {@link FlywayEndpoint}.
@@ -48,10 +47,9 @@
4847
class FlywayEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
4948

5049
@Test
51-
void flyway() throws Exception {
52-
this.mockMvc.perform(get("/actuator/flyway"))
53-
.andExpect(status().isOk())
54-
.andDo(MockMvcRestDocumentation.document("flyway",
50+
void flyway() {
51+
assertThat(this.mvc.get().uri("/actuator/flyway")).hasStatusOk()
52+
.apply(MockMvcRestDocumentation.document("flyway",
5553
responseFields(fieldWithPath("contexts").description("Application contexts keyed by id"),
5654
fieldWithPath("contexts.*.flywayBeans.*.migrations")
5755
.description("Migrations performed by the Flyway instance, keyed by Flyway bean name."))

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

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,11 @@
5252
import org.springframework.restdocs.payload.FieldDescriptor;
5353
import org.springframework.util.unit.DataSize;
5454

55+
import static org.assertj.core.api.Assertions.assertThat;
5556
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
5657
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
5758
import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
5859
import static org.springframework.restdocs.payload.PayloadDocumentation.subsectionWithPath;
59-
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
60-
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
6160

6261
/**
6362
* Tests for generating documentation describing the {@link HealthEndpoint}.
@@ -72,7 +71,7 @@ class HealthEndpointDocumentationTests extends MockMvcEndpointDocumentationTests
7271
subsectionWithPath("details").description("Details of the health of a specific part of the application."));
7372

7473
@Test
75-
void health() throws Exception {
74+
void health() {
7675
FieldDescriptor status = fieldWithPath("status").description("Overall status of the application.");
7776
FieldDescriptor components = fieldWithPath("components").description("The components that make up the health.");
7877
FieldDescriptor componentStatus = fieldWithPath("components.*.status")
@@ -84,24 +83,21 @@ void health() throws Exception {
8483
.description("Details of the health of a specific part of the application. "
8584
+ "Presence is controlled by `management.endpoint.health.show-details`.")
8685
.optional();
87-
this.mockMvc.perform(get("/actuator/health").accept(MediaType.APPLICATION_JSON))
88-
.andExpect(status().isOk())
89-
.andDo(document("health",
86+
assertThat(this.mvc.get().uri("/actuator/health").accept(MediaType.APPLICATION_JSON)).hasStatusOk()
87+
.apply(document("health",
9088
responseFields(status, components, componentStatus, nestedComponents, componentDetails)));
9189
}
9290

9391
@Test
94-
void healthComponent() throws Exception {
95-
this.mockMvc.perform(get("/actuator/health/db").accept(MediaType.APPLICATION_JSON))
96-
.andExpect(status().isOk())
97-
.andDo(document("health/component", responseFields(componentFields)));
92+
void healthComponent() {
93+
assertThat(this.mvc.get().uri("/actuator/health/db").accept(MediaType.APPLICATION_JSON)).hasStatusOk()
94+
.apply(document("health/component", responseFields(componentFields)));
9895
}
9996

10097
@Test
101-
void healthComponentInstance() throws Exception {
102-
this.mockMvc.perform(get("/actuator/health/broker/us1").accept(MediaType.APPLICATION_JSON))
103-
.andExpect(status().isOk())
104-
.andDo(document("health/instance", responseFields(componentFields)));
98+
void healthComponentInstance() {
99+
assertThat(this.mvc.get().uri("/actuator/health/broker/us1").accept(MediaType.APPLICATION_JSON)).hasStatusOk()
100+
.apply(document("health/instance", responseFields(componentFields)));
105101
}
106102

107103
@Configuration(proxyBeanMethods = false)

0 commit comments

Comments
 (0)