JUnit5에서 prettyPrint() 적용하기
727
작성한 질문수 42
@ExtendWith({RestDocumentationExtension.class, SpringExtension.class})
@SpringBootTest
class EventControllerTest {
private MockMvc mockMvc;
@Autowired
private ObjectMapper objectMapper;
@Autowired
private WebApplicationContext context;
@Autowired
private EventRepository eventRepository;
@BeforeEach
void init(RestDocumentationContextProvider restDocumentation) {
this.mockMvc = MockMvcBuilders
.webAppContextSetup(this.context)
.addFilters(new CharacterEncodingFilter("UTF-8", true))
.apply(documentationConfiguration(restDocumentation)
.operationPreprocessors()
.withRequestDefaults(modifyUris().host("yoonjoy.me").removePort(), prettyPrint())
.withResponseDefaults(modifyUris().host("yoonjoy.me").removePort(), prettyPrint()))
.alwaysDo(print())
.build();
}
추가로 addFilters에 UTF-8 설정을 통해 responseBody에서 한글이 깨지는 것을 막고,
modifyUris을 통해 호스트 url localhost을 원하는 문자로 바꿀 수 있습니다.
답변 1
Spring 시큐리티 관련해서 WebSecurityConfigurationAdapter
0
84
1
junit5 사용하시는 분들
0
99
1
자바 빈 스펙을 준수하는지 체크하는 테스트
0
255
2
REST API 개발 중 비즈니스 로직 적용 부분의 JSON 에러
0
257
1
스프링 부트 3버전에서의 실습
0
196
1
java.lang.AssertionError: Status
0
541
2
spring doc 관련 파일 생성 관련 배포 관련 질문 드립니다.
0
292
1
섹션2 201응답받기 부분 테스트 404에러 질문입니다
0
744
1
강의 자료가 404입니다 확인 부탁 드려요!
0
482
1
연동 DB문의
0
368
1
이벤트 Repository강의 중 Event 클래스에 private Integer Id; 위치 질문
0
509
1
(Mac) postgressql 관련하여 port kill 해도 다시 살아나는 경우
0
387
0
maven으로 생성한 docs파일(index.html)에서의 not found 오류 질문
0
636
1
테스트 오류 질문드립니다.
0
518
1
docs 요청값이 반영이 안되네요... (해결)
-1
399
1
psql 적용 후 에러
0
825
2
mvn package 시 다음과 같은 에러가 나시면
0
769
2
Event에 Account manager를 추가했으면 문서화 필요
0
277
1
2년 훨씬 전 부터 Restlet-> Talend API 로 바뀌었습니다~
1
475
1
asciidoc 추가 스니펫 에러 해결법
0
403
1
_links 는 현재 fieldWithPath 를 해주지 않아도 됩니다.
0
431
3
깃랩 처음 사용자를 위한 index.adoc raw 보는 법
0
338
1
eclipse 쓰시는 분을 위한 maven-resources-plugin 팁
0
342
1
부트 + jupiter 인 경우 설정법
0
346
1





