<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>MockMvc on 얼쑤 · Team Edo</title><link>https://team-edo.github.io/tags/mockmvc/</link><description>Recent content in MockMvc on 얼쑤 · Team Edo</description><generator>Hugo</generator><language>ko-kr</language><lastBuildDate>Thu, 29 Oct 2026 00:00:00 +0900</lastBuildDate><atom:link href="https://team-edo.github.io/tags/mockmvc/index.xml" rel="self" type="application/rss+xml"/><item><title>단독 MockMvc에서 JWT가 비어 500이 난 이유</title><link>https://team-edo.github.io/posts/2026/10/mockmvc-principal-test-boundaries/</link><pubDate>Thu, 29 Oct 2026 00:00:00 +0900</pubDate><guid>https://team-edo.github.io/posts/2026/10/mockmvc-principal-test-boundaries/</guid><description>&lt;p>성장 화면 API의 단독 MockMvc 테스트를 작성하고 실행하니 정상 요청과 400을 기대한 요청이 모두 500으로 실패했습니다. 로그를 따라가 보니 컨트롤러의 &lt;code>@AuthenticationPrincipal jwt: Jwt&lt;/code>에 값이 들어오지 않았습니다. Kotlin은 non-null 매개변수에 &lt;code>null&lt;/code>이 넘어오는 순간 예외를 던졌고, 요청은 정작 검사하려던 코드까지 가지 못했습니다.&lt;/p>
&lt;h2 id="단독-테스트가-빠뜨린-연결을-채웠다">인자 해석기와 예외 처리기 등록&lt;/h2>
&lt;p>&lt;code>standaloneSetup&lt;/code>은 제가 넘긴 컨트롤러를 중심으로 작은 MVC 환경을 만듭니다. 실제 앱에서 쿠키를 읽고 JWT를 검증하는 보안 필터까지 자동으로 붙지는 않습니다. 요청에 인증 후처리기만 붙인 첫 테스트에서는 컨트롤러가 읽을 인증 정보가 비어 있었습니다.&lt;/p></description></item></channel></rss>