JUnit5는 JUnit Platform, JUnit Jupiter, JUnit Vintage로 구성된다.
TestEngine
API를 정의**한다. 추가적으로 command line에서 platform을 실행하는 Console Launcher와 platform에서 하나 이상의 test engine을 사용한 custom test suite를 실행하기 위한 JUnit Platform Suite Engine을 제공한다.TestEngine
을 제공한다.TestEngine
을 제공한다.JUnit 5 requires Java 8 (or higher) at runtime. However, you can still test code that has been compiled with previous versions of the JDK.
다음은 JUnit Jupiter에서 test를 작성하기 위한 최소 조건으로 간단한 test를 작성한 것이다.
class MyFirstJUnitJupiterTests {
private final Calculator calculator = new Calculator();
@Test
void addition() {
assertEquals(2, calculator.add(1, 1));
}
}