Writes and improves JUnit 5 unit tests for Java projects. Use when asked to create unit tests, write parameterized/data-driven tests, improve test coverage, set up mocking with Mockito, or follow testing best practices with JUnit Jupiter. Covers test structure, assertions, @ParameterizedTest, @ValueSource, @CsvSource, and @MethodSource.
src/test/java.junit-jupiter-api, junit-jupiter-engine, and junit-jupiter-params for parameterized tests.mvn test or gradle test.Test suffix, e.g., CalculatorTest for a Calculator class.@Test for test methods.methodName_should_expectedBehavior_when_scenario.@BeforeEach and @AfterEach for per-test setup and teardown.@BeforeAll and @AfterAll for per-class setup and teardown (must be static methods).@DisplayName to provide a human-readable name for test classes and methods.@ParameterizedTest to mark a method as a parameterized test.@ValueSource for simple literal values (strings, ints, etc.).@MethodSource to refer to a factory method that provides test arguments as a Stream, Collection, etc.@CsvSource for inline comma-separated values.@CsvFileSource to use a CSV file from the classpath.@EnumSource to use enum constants.org.junit.jupiter.api.Assertions or AssertJ for more fluent assertions.assertThrows / assertDoesNotThrow for exception testing.assertAll.@Mock and @InjectMocks annotations from Mockito to simplify mock creation and injection.@Tag to categorize tests (e.g., @Tag("fast"), @Tag("integration")).@TestMethodOrder(MethodOrderer.OrderAnnotation.class) and @Order to control test execution order when strictly necessary.@Disabled to temporarily skip a test method or class, providing a reason.@Nested to group tests in a nested inner class for better organization and structure.