|
38 | 38 | import org.springframework.restdocs.payload.JsonFieldType; |
39 | 39 | import org.springframework.restdocs.payload.ResponseFieldsSnippet; |
40 | 40 |
|
41 | | -import static org.assertj.core.api.Assertions.assertThat; |
42 | 41 | import static org.springframework.restdocs.payload.PayloadDocumentation.beneathPath; |
43 | 42 | import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; |
44 | 43 | import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields; |
| 44 | +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; |
| 45 | +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; |
45 | 46 |
|
46 | 47 | /** |
47 | 48 | * Tests for generating documentation describing the {@link InfoEndpoint}. |
|
51 | 52 | class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests { |
52 | 53 |
|
53 | 54 | @Test |
54 | | - void info() { |
55 | | - assertThat(this.mvc.get().uri("/actuator/info")).hasStatusOk() |
56 | | - .apply(MockMvcRestDocumentation.document("info", gitInfo(), buildInfo(), osInfo(), processInfo())); |
| 55 | + void info() throws Exception { |
| 56 | + this.mockMvc.perform(get("/actuator/info")) |
| 57 | + .andExpect(status().isOk()) |
| 58 | + .andDo(MockMvcRestDocumentation.document("info", gitInfo(), buildInfo(), osInfo(), processInfo())); |
57 | 59 | } |
58 | 60 |
|
59 | 61 | private ResponseFieldsSnippet gitInfo() { |
@@ -95,20 +97,7 @@ private ResponseFieldsSnippet processInfo() { |
95 | 97 | fieldWithPath("parentPid").description("Parent Process ID (or -1).").type(JsonFieldType.NUMBER), |
96 | 98 | fieldWithPath("owner").description("Process owner.").type(JsonFieldType.STRING), |
97 | 99 | fieldWithPath("cpus").description("Number of CPUs available to the process.") |
98 | | - .type(JsonFieldType.NUMBER), |
99 | | - fieldWithPath("memory").description("Memory information."), |
100 | | - fieldWithPath("memory.heap").description("Heap memory."), |
101 | | - fieldWithPath("memory.heap.init").description("The number of bytes initially requested by the JVM."), |
102 | | - fieldWithPath("memory.heap.used").description("The number of bytes currently being used."), |
103 | | - fieldWithPath("memory.heap.committed").description("The number of bytes committed for JVM use."), |
104 | | - fieldWithPath("memory.heap.max") |
105 | | - .description("The maximum number of bytes that can be used by the JVM (or -1)."), |
106 | | - fieldWithPath("memory.nonHeap").description("Non-heap memory."), |
107 | | - fieldWithPath("memory.nonHeap.init").description("The number of bytes initially requested by the JVM."), |
108 | | - fieldWithPath("memory.nonHeap.used").description("The number of bytes currently being used."), |
109 | | - fieldWithPath("memory.nonHeap.committed").description("The number of bytes committed for JVM use."), |
110 | | - fieldWithPath("memory.nonHeap.max") |
111 | | - .description("The maximum number of bytes that can be used by the JVM (or -1).")); |
| 100 | + .type(JsonFieldType.NUMBER)); |
112 | 101 | } |
113 | 102 |
|
114 | 103 | @Configuration(proxyBeanMethods = false) |
|
0 commit comments