유닛테스트

    JAVA/JAVA 정리

    [JAVA] 유닛테스트 @DisplayName 작동 안할 때 / 한국어 안나올 때

    @DisplayName("1. 누구나 메인페이지에 접근할 수 있다.") @Test @WithAnonymousUser public void anonymous_can_index() throws Exception { mockMvc.perform(get("/")) .andDo(print()) .andExpect(status().isOk()) .andReturn().getResponse().getContentAsString();= } 유닛테스트를 하던 중 @DisplayName가 작동하지 않고 영어로 나왔다. 이럴 때는 import부분에 수정이 필요하다. import org.junit.Test; 위 코드를 아래처럼 바꿔주면 정상적으로 출력된다. import org.junit.jupiter.api.Test;