JUnit 5 User Guide

JUnit5 완벽 가이드


Overview


What is JUnit5?

JUnit5는 JUnit Platform, JUnit Jupiter, JUnit Vintage로 구성된다.

스크린샷 2022-11-07 09.35.04.png

Supported Java Versions

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.

Writing Simple Tests

다음은 JUnit Jupiter에서 test를 작성하기 위한 최소 조건으로 간단한 test를 작성한 것이다.

class MyFirstJUnitJupiterTests {

	  private final Calculator calculator = new Calculator();
	  
	  @Test 
	  void addition() {
		    assertEquals(2, calculator.add(1, 1)); 
	  }
}