TA 역할 Spring 경계 smoke (role-ta-live-v2-001)
This commit is contained in:
parent
c0edec657d
commit
66083b8c61
1 changed files with 26 additions and 0 deletions
|
|
@ -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"));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue