개발/ETC
[JUnit Test] JUnit 수행 시 에러 - NoSuchMethodError: 'java.util.Set org.junit.platform.engine.TestDescriptor.getAncestors()
신매력
2023. 11. 20. 21:15
STS, gradle 빌드, 스프링부트 버전 2.7.x를 쓰고 있다.
사용하고 있는 디펜던시는 아래와 같다.
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.3.1'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter-test:2.3.1'
implementation 'org.apache.tomcat.embed:tomcat-embed-jasper'
implementation 'javax.servlet:jstl:1.2'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.5.7'
}
JUnit Test를 수행하면 아래와 같은 에러가 계속 뜬다.
(2023년 8월자 STS에선 안 그랬는데, 2023년 10월 23일쯤 다운 받은.. 새로운 STS와 뭔가가 꼬인걸까?)
NoSuchMethodError: 'java.util.Set org.junit.platform.engine.TestDescriptor.getAncestors()
해결 방법은 dependencies에 아래 항목을 추가하는 것이다.
(stackoverflow 감사합니다!!!!!)
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'