1.의의

2.JUnit

 assertEquals(예상 값, 실제 값);  //단정문

3.JUnit 5

Untitled

1)의의

2)JUnit Platform

3)JUnit Jupiter

4)JUnit Vintage

5)테스트 러너(test runner)

Untitled

4.Spring 에서 JUnit 실행하기

  1. Junit 5 의존성 추가
<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
			<exclusions>
					 <exclusion>
							<groupId>org.junit.vintage</groupId>
							<artifactId>junit-vintage-engine</artifactId>
						</exclusion>
			</exclusions>
</dependency>
dependencies {
    // 생략
    testImplementation('org.junit.jupiter:junit-jupiter-api:5.2.0')
    testCompile('org.junit.jupiter:junit-jupiter-params:5.2.0')
    testRuntime('org.junit.jupiter:junit-jupiter-engine:5.2.0')
    // 생략
}

2)프로젝트 패키지 구성

Untitled

3.spring boot test