|
1 | 1 | package test.org.springdoc.api.app68;
|
2 | 2 |
|
| 3 | +import org.hamcrest.Matchers; |
3 | 4 | import org.junit.Test;
|
4 | 5 | import org.junit.runner.RunWith;
|
5 | 6 | import org.slf4j.Logger;
|
|
13 | 14 | import org.springframework.test.web.servlet.MockMvc;
|
14 | 15 | import test.org.springdoc.api.AbstractSpringDocTest;
|
15 | 16 |
|
| 17 | +import static org.hamcrest.Matchers.contains; |
16 | 18 | import static org.hamcrest.Matchers.containsString;
|
| 19 | +import static org.hamcrest.Matchers.hasSize; |
17 | 20 | import static org.hamcrest.Matchers.is;
|
18 | 21 | import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
19 |
| -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; |
| 22 | +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; |
| 23 | +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; |
| 24 | +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; |
20 | 25 | import static test.org.springdoc.utils.FileUtils.getContent;
|
21 | 26 |
|
22 | 27 | @RunWith(SpringRunner.class)
|
@@ -67,6 +72,20 @@ public void testApp4() throws Exception {
|
67 | 72 | @Test
|
68 | 73 | public void testActuator() throws Exception {
|
69 | 74 | mockMvc.perform(get(Constants.DEFAULT_API_DOCS_URL)).andExpect(status().isOk())
|
70 |
| - .andExpect(jsonPath("$.openapi", is("3.0.1"))).andExpect(jsonPath("$.paths./actuator/info.get.operationId", containsString("handle"))).andExpect(jsonPath("$.paths./actuator/health.get.operationId", containsString("handle"))); |
| 75 | + .andExpect(jsonPath("$.openapi", is("3.0.1"))) |
| 76 | + .andExpect(jsonPath("$.paths./actuator/info.get.operationId", containsString("handle_"))) |
| 77 | + .andExpect(jsonPath("$.paths./actuator/info.get.summary", Matchers.is("Actuator web endpoint 'info'"))) |
| 78 | + .andExpect(jsonPath("$.paths./actuator/health.get.operationId", containsString("handle_"))); |
| 79 | + } |
| 80 | + |
| 81 | + @Test |
| 82 | + public void testActuatorDescription() throws Exception { |
| 83 | + mockMvc.perform(get(Constants.DEFAULT_API_DOCS_URL)).andExpect(status().isOk()) |
| 84 | + .andExpect(jsonPath("$.openapi", is("3.0.1"))) |
| 85 | + .andExpect(jsonPath("$.tags", hasSize(4))) |
| 86 | + .andExpect(jsonPath("$.tags[?(@.name == '"+Constants.SPRINGDOC_ACTUATOR_TAG+"')].name", contains(Constants.SPRINGDOC_ACTUATOR_TAG))) |
| 87 | + .andExpect(jsonPath("$.tags[?(@.name == '"+Constants.SPRINGDOC_ACTUATOR_TAG+"')].description", contains(Constants.SPRINGDOC_ACTUATOR_DESCRIPTION))) |
| 88 | + .andExpect(jsonPath("$.tags[?(@.name == '"+Constants.SPRINGDOC_ACTUATOR_TAG+"')].externalDocs.description", contains(Constants.SPRINGDOC_ACTUATOR_DOC_DESCRIPTION))) |
| 89 | + .andExpect(jsonPath("$.tags[?(@.name == '"+Constants.SPRINGDOC_ACTUATOR_TAG+"')].externalDocs.url", contains(Constants.SPRINGDOC_ACTUATOR_DOC_URL))); |
71 | 90 | }
|
72 | 91 | }
|
0 commit comments