Spring 전환 골격 최신 reviewer 검증 #1

Open
forge-bot wants to merge 7 commits from forge/role-developer-reverify-550-001-attempt-1-run-41adeb6fc379 into main
Showing only changes of commit 82ce0fe5e6 - Show all commits

View file

@ -0,0 +1,35 @@
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;
/**
* Focused unit tests for HealthController.
* Uses @WebMvcTest for slice testing without full context.
*/
@WebMvcTest(HealthController.class)
class HealthControllerTest {
@Autowired
private MockMvc mockMvc;
@Test
void health_shouldReturnUpStatus() throws Exception {
mockMvc.perform(get("/api/health"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.status").value("UP"));
}
@Test
void ping_shouldReturnPong() throws Exception {
mockMvc.perform(get("/api/ping"))
.andExpect(status().isOk())
.andExpect(org.springframework.test.web.servlet.result.MockMvcResultMatchers.content().string("pong"));
}
}