본문 바로가기
Test

@Before, @After => @BeforeEach, @AfterEach

by PROMISE_YOO 2021. 11. 23.

@Before, @After 두개를 사용해서 test 를 해보니 제대로 작동하지 못하는 것을 발견했습니다

junit5 부터는  @BeforeEach,@AfterEach 로 사용하니 문제가 해결됐습니다.

 

import할때도 아래와 같이 작성해야합니다.

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

 

 

참고 블로그

https://go-coding.tistory.com/89