트러블 슈팅
junit4 테스트 시 'Cannot resolve symbol 'RunWith' 오류 해결 방법
박망고씨
2024. 3. 24. 15:35
build.gradle의 dependencies에 다음 코드를 추가해주고 reload 시켜주면
//JUnit4 추가
testImplementation("org.junit.vintage:junit-vintage-engine") {
exclude group: "org.hamcrest", module: "hamcrest-core"
}
import org.junit.runner.RunWith;
import문이 잘 먹힌다. 해결!
참고로 junit5는 @RunWith(SpringRunner.class)이 아닌 @ExtendWith(SpringExtension.class)를 사용한다고 한다.
참고한 블로그
: https://velog.io/@hyeon030/Junit5-RunWithSpringRunner.class