|
|
|
@ -36,13 +36,13 @@ import org.springframework.context.annotation.Bean; |
|
|
|
import org.springframework.context.annotation.Configuration; |
|
|
|
import org.springframework.context.annotation.Configuration; |
|
|
|
import org.springframework.mock.web.MockServletContext; |
|
|
|
import org.springframework.mock.web.MockServletContext; |
|
|
|
import org.springframework.test.web.servlet.MockMvc; |
|
|
|
import org.springframework.test.web.servlet.MockMvc; |
|
|
|
|
|
|
|
import org.springframework.test.web.servlet.setup.MockMvcBuilders; |
|
|
|
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; |
|
|
|
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; |
|
|
|
|
|
|
|
|
|
|
|
import static org.hamcrest.CoreMatchers.containsString; |
|
|
|
import static org.hamcrest.CoreMatchers.containsString; |
|
|
|
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; |
|
|
|
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; |
|
|
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; |
|
|
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; |
|
|
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; |
|
|
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; |
|
|
|
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Integration tests for the health endpoint when Spring Security is not available. |
|
|
|
* Integration tests for the health endpoint when Spring Security is not available. |
|
|
|
@ -66,7 +66,7 @@ public class NoSpringSecurityHealthMvcEndpointIntegrationTests { |
|
|
|
this.context.setServletContext(new MockServletContext()); |
|
|
|
this.context.setServletContext(new MockServletContext()); |
|
|
|
this.context.register(TestConfiguration.class); |
|
|
|
this.context.register(TestConfiguration.class); |
|
|
|
this.context.refresh(); |
|
|
|
this.context.refresh(); |
|
|
|
MockMvc mockMvc = webAppContextSetup(this.context).build(); |
|
|
|
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(this.context).build(); |
|
|
|
mockMvc.perform(get("/health")).andExpect(status().isOk()) |
|
|
|
mockMvc.perform(get("/health")).andExpect(status().isOk()) |
|
|
|
.andExpect(content().string(containsString("\"hello\":\"world\""))); |
|
|
|
.andExpect(content().string(containsString("\"hello\":\"world\""))); |
|
|
|
} |
|
|
|
} |
|
|
|
|