41 lines
1.4 KiB
Java
41 lines
1.4 KiB
Java
package com.baeldung.shutdown;
|
|
|
|
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
|
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
|
|
|
import org.junit.Before;
|
|
import org.junit.Ignore;
|
|
import org.junit.Test;
|
|
import org.junit.runner.RunWith;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|
import org.springframework.test.web.servlet.MockMvc;
|
|
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
|
import org.springframework.web.context.WebApplicationContext;
|
|
|
|
@RunWith(SpringJUnit4ClassRunner.class)
|
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK, classes = Application.class)
|
|
@AutoConfigureMockMvc
|
|
public class ShutdownApplicationIntegrationTest {
|
|
|
|
@Autowired
|
|
private MockMvc mockMvc;
|
|
|
|
@Autowired
|
|
private WebApplicationContext wac;
|
|
|
|
@Before
|
|
public void setup() {
|
|
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
|
|
}
|
|
|
|
@Test
|
|
@Ignore
|
|
public void givenBootApp_whenShutdownEndpoint_thenExit() throws Exception {
|
|
|
|
mockMvc.perform(post("/shutdown")).andExpect(status().isOk());
|
|
}
|
|
}
|