-
카테고리
-
세부 분야
백엔드
-
해결 여부
미해결
MemberRepositoryTest 실행시 오류
22.07.27 21:13 작성 조회수 402
0
실행시 다음과 같은 에러가 발생합니다.
initializationError()
build.gradle 파일코드는 아래와 같습니다.
plugins {
id 'org.springframework.boot' version '2.7.2'
id 'io.spring.dependency-management' version '1.0.12.RELEASE'
id 'java'
}
group = 'jpabook'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-devtools'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
//JUnit4 추가
testImplementation("org.junit.vintage:junit-vintage-engine") {
exclude group: "org.hamcrest", module: "hamcrest-core"
}
}
test {
useJUnitPlatform()
}
ylm 파일 띄어쓰기도 맞췄고, url의 MVCC=TRUE도 제거했으며
build Tools > Gradle 도 IntelliJ IDEA로 맞췄는데
어느부분이 문제인지 모르겠습니다.
H2 콘솔도 잘 켠 것 같습니다만..
어디가 잘못된걸까요..?
답변을 작성해보세요.
0
kcood
2022.07.28
안녕하세요 , 저도 질문자분과 동일한 오류가 발생했어서 답변을 남깁니다.
저의 경우 테스트 클래스 위에 붙인 2개의 어노테이션
@RunWith(SpringRunner.class)
@SpringBootTest
public class MemberRepositoryTest {
중 @RunWith(SpringRunner.class)를 없애니 테스트를 정상 통과했습니다!
혹시 해결된 이유가 무엇일까요?
김영한
지식공유자2022.08.07
안녕하세요. 신동윤님 @RunWith는 Junit4일때 사용하는데요. 현재 스프링 부트의 경우 JUnit5를 기본으로 사용해서 해당 코드를 제거해야 동작합니다.
감사합니다.
답변 2