Spring 전환 최소 실행 골격 재검증 (role-developer-reverify-001)
This commit is contained in:
parent
640c4312a6
commit
2642235adf
1 changed files with 31 additions and 0 deletions
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.example.controller;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
||||||
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
|
|
||||||
|
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||||
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||||
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||||
|
|
||||||
|
@WebMvcTest(HealthController.class)
|
||||||
|
class HealthControllerTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MockMvc mockMvc;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void health_returnsUpStatus() throws Exception {
|
||||||
|
mockMvc.perform(get("/api/health"))
|
||||||
|
.andExpect(status().isOk())
|
||||||
|
.andExpect(jsonPath("$.status").value("UP"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void ping_returnsPong() throws Exception {
|
||||||
|
mockMvc.perform(get("/api/ping"))
|
||||||
|
.andExpect(status().isOk())
|
||||||
|
.andExpect(org.hamcrest.Matchers.content().string("pong"));
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue