1. 프로젝트 인코딩 설정 확인:
File > Settings (윈도우) 또는 IntelliJ IDEA > Preferences (맥)로 이동
Editor > File Encodings에서 Global Encoding과 Project Encoding이 UTF-8로 설정되어 있는지 확인
2. Run/Debug 구성에 VM 옵션 추가:
Run > Edit Configurations 메뉴로 이동
해당 테스트의 구성을 선택하고 VM options 필드에 -Dfile.encoding=UTF-8 추가
3. IDE의 .vmoptions 파일 수정:
Help > Edit Custom VM Options 선택
파일 끝에 -Dfile.encoding=UTF-8와 -Dconsole.encoding=UTF-8 두 줄 추가
4. Gradle 설정 수정 (Gradle 프로젝트의 경우):
tasks.withType(JavaExec) {
systemProperty "file.encoding", "UTF-8"
}
tasks.withType(Test) {
systemProperty "file.encoding", "UTF-8"
}
5. 소스 파일 인코딩 확인:
테스트 파일을 열고 우측 하단의 인코딩 설정이 UTF-8인지 확인