1. 글을 쓰게 된 배경

프로젝트에서 각자 맡은 부분의 test 코드를 작성해야하는데 스프링 시큐리티 @AuthenticationPrincipal 테스트해야 하는데 기존의 Fixtures 제작만으로 해결이 되지 않아서 작성하게 되었다

2. 미리 알고 있어야 할 내용

2.1 @MockBean VS @Autowired

2.2 Spring Security (User, UserDetails 차이)

3. TestCode를 작성할 Controller 코드

4. Test Code1 (@WithMockUser 사용)