hanbee1005 / springboot-aws

"스프링 부트와 AWS로 혼자 구현하는 웹 서비스" 책 따라하기
0 stars 0 forks source link

test 충돌 에러 #2

Open hanbee1005 opened 3 years ago

hanbee1005 commented 3 years ago

p.297 ec2에서 ./gradlew test 수행 시 테스트 에러 발생

에러

1. lombok 패키지 관련 에러

2. unchecked 에러

3. test 관련 Gradle Exception

hanbee1005 commented 3 years ago

1. lombok 패키지 관련 에러 처리

build.gradle 파일에 lombok 관련 코드를 아래와 같이 수정

// lombok
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
hanbee1005 commented 3 years ago

2. unchecked 에러

unchecked warning이 발생하는 코드에 아래와 같은 애노테이션 추가

@SuppressWarnings("unchecked")

참고: https://colinch4.github.io/2020-07-30/24/

hanbee1005 commented 3 years ago

3. test 관련 Gradle Exception

처음 프로젝트 생성 시 build.gradle 파일에 아래와 같은 테스트 관련 코드가 적혀 있었는데 이는 JUnit5를 사용하는 코드인 것 같습니다.

test {
    useJUnitPlatform()
}

이 코드를 그대로 둔 상태에서 dependencies 부분에 아래와 같이 spring-boot-starter-test 의존성을 추가하였습니다.

testImplementation 'org.springframework.boot:spring-boot-starter-test'

spring-boot-starter-test 는 jUInit4를 포함하고 있기 때문에 충돌로 인해 발생한 에러 같습니다.

따라서, 처음에 남아있던 test { useJUnitPlatform() } 코드를 삭제하고 정상 동작하는 것을 확인하였습니다.