Sobes.tech
Junior — Middle

What versions of JUnit have you used in your practice?

sobes.tech AI

Answer from AI

In Java development practice, the following versions of JUnit are often used:

  • JUnit 4 — the classic version with annotations @Test, @Before, @After, and support for rules. It was widely used before the appearance of JUnit 5.
  • JUnit 5 (Jupiter) — a modern framework with modular architecture, support for extensions, improved annotations, and capabilities for parameterized tests.

Example of a simple test in JUnit 5:

import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;

class CalculatorTest {
    @Test
    void addition() {
        assertEquals(4, 2 + 2);
    }
}

JUnit 3 is now almost not used, and JUnit 5 gradually replaces JUnit 4 in new projects.

What versions of JUnit have you used in your… - sobes.tech