From 66083b8c61fe6a4e0efdba7951529d3c3123a26a Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 08:00:12 +0000 Subject: [PATCH] =?UTF-8?q?TA=20=EC=97=AD=ED=95=A0=20Spring=20=EA=B2=BD?= =?UTF-8?q?=EA=B3=84=20smoke=20(role-ta-live-v2-001)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exception/GlobalExceptionHandlerTest.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/test/java/com/runtimematrix/exception/GlobalExceptionHandlerTest.java diff --git a/src/test/java/com/runtimematrix/exception/GlobalExceptionHandlerTest.java b/src/test/java/com/runtimematrix/exception/GlobalExceptionHandlerTest.java new file mode 100644 index 0000000..0da51bf --- /dev/null +++ b/src/test/java/com/runtimematrix/exception/GlobalExceptionHandlerTest.java @@ -0,0 +1,26 @@ +package com.runtimematrix.exception; + +import com.runtimematrix.dto.ErrorResponse; +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.*; + +@WebMvcTest +class GlobalExceptionHandlerTest { + + @Autowired + private MockMvc mockMvc; + + @Test + void businessException_returnsConsistentErrorFormat() throws Exception { + mockMvc.perform(get("/api/v1/roles/999")) + .andExpect(status().isNotFound()) + .andExpect(jsonPath("$.code").value("ERR_ROLE_NOT_FOUND")) + .andExpect(jsonPath("$.timestamp").exists()) + .andExpect(jsonPath("$.path").value("/api/v1/roles/999")); + } +}