• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    미해결

Assertions.assertThat()이 안됩니다.

23.06.07 18:00 작성 조회수 642

0


=========================================
[질문 템플릿]
1. 강의 내용과 관련된 질문인가요? (예)
2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (아니오)
3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예)

[질문 내용]

강의와 똑같이 작성했습니다.

assertThat이 안되고

junit assert 임포트도 안먹히는 거 같은데 어떻게 해결하나요?
코드1.png

그래들리는 이렇습니다.

plugins {
    id 'java'
    id 'war'
    id 'org.springframework.boot' version '2.7.13-SNAPSHOT'
    id 'io.spring.dependency-management' version '1.0.15.RELEASE'
}

group = 'jpabook'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
    maven { url 'https://repo.spring.io/milestone' }
    maven { url 'https://repo.spring.io/snapshot' }
}

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'
    providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'junit:junit:4.13.2'
    testImplementation 'org.assertj:assertj-core'


}

tasks.named('test') {
    useJUnitPlatform()
}

 

버전이 높아서 그런거면 버전을 낮게 설정해야하나요?

 

답변 3

·

답변을 작성해보세요.

1

임동현님의 프로필

임동현

2023.06.08

junit 4로 갖고와서 그런거같아요. junit5으로 바꾸셔야합니다

1

주지성님의 프로필

주지성

2023.06.07

혹시 import가 안된 부분을 전부 지우시고
import org.assertj.core.api.Assertions; 를 붙여보시겠어요?
그래도 안된다면 답글 남겨주세요

0

Berliner님의 프로필

Berliner

2023.07.17

안녕하세요.

인텔리J를 사용하지 않고 스프링부트로만 하고 있는데

에러.JPG여기서

에러2.JPG어떻게 설정을 하면 될까요?