Fix errors accidentally added to InfoEndpointDocumentationTests

This commit is contained in:
Phillip Webb
2025-05-20 14:26:11 -07:00
parent 64aefcb658
commit aa9cc4ae0e

View File

@@ -38,10 +38,11 @@ import org.springframework.restdocs.payload.FieldDescriptor;
import org.springframework.restdocs.payload.JsonFieldType;
import org.springframework.restdocs.payload.ResponseFieldsSnippet;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.restdocs.payload.PayloadDocumentation.beneathPath;
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* Tests for generating documentation describing the {@link InfoEndpoint}.
@@ -51,9 +52,10 @@ import static org.springframework.restdocs.payload.PayloadDocumentation.response
class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
@Test
void info() {
assertThat(this.mvc.get().uri("/actuator/info")).hasStatusOk()
.apply(MockMvcRestDocumentation.document("info", gitInfo(), buildInfo(), osInfo(), processInfo()));
void info() throws Exception {
this.mockMvc.perform(get("/actuator/info"))
.andExpect(status().isOk())
.andDo(MockMvcRestDocumentation.document("info", gitInfo(), buildInfo(), osInfo(), processInfo()));
}
private ResponseFieldsSnippet gitInfo() {
@@ -95,20 +97,7 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
fieldWithPath("parentPid").description("Parent Process ID (or -1).").type(JsonFieldType.NUMBER),
fieldWithPath("owner").description("Process owner.").type(JsonFieldType.STRING),
fieldWithPath("cpus").description("Number of CPUs available to the process.")
.type(JsonFieldType.NUMBER),
fieldWithPath("memory").description("Memory information."),
fieldWithPath("memory.heap").description("Heap memory."),
fieldWithPath("memory.heap.init").description("The number of bytes initially requested by the JVM."),
fieldWithPath("memory.heap.used").description("The number of bytes currently being used."),
fieldWithPath("memory.heap.committed").description("The number of bytes committed for JVM use."),
fieldWithPath("memory.heap.max")
.description("The maximum number of bytes that can be used by the JVM (or -1)."),
fieldWithPath("memory.nonHeap").description("Non-heap memory."),
fieldWithPath("memory.nonHeap.init").description("The number of bytes initially requested by the JVM."),
fieldWithPath("memory.nonHeap.used").description("The number of bytes currently being used."),
fieldWithPath("memory.nonHeap.committed").description("The number of bytes committed for JVM use."),
fieldWithPath("memory.nonHeap.max")
.description("The maximum number of bytes that can be used by the JVM (or -1)."));
.type(JsonFieldType.NUMBER));
}
@Configuration(proxyBeanMethods = false)