Spring 전환 최소 실행 골격 재검증 (role-developer-reverify-001)

This commit is contained in:
forge-bot 2026-07-14 05:27:31 +00:00
parent 3d9fe0e272
commit 575d6ebcb7

View file

@ -0,0 +1,38 @@
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.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import static org.hamcrest.Matchers.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
@SpringBootTest
@AutoConfigureMockMvc
class HealthControllerTest {
@Autowired
private MockMvc mockMvc;
@Test
void healthEndpointReturnsUp() throws Exception {
mockMvc.perform(get("/health"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.status", is("UP")));
}
@Test
void healthEndpointReturnsJson() throws Exception {
MvcResult result = mockMvc.perform(get("/health"))
.andExpect(status().isOk())
.andReturn();
String content = result.getResponse().getContentAsString();
org.assertj.core.api.Assertions.assertThat(content)
.contains("{\"status\":\"UP\"}");
}
}