When JUnit 5 tests leave temporary directories behind, the problem can be traced to annotation placement, file locks, or parallel execution. This guide walks through diagnosing the issue, checking the test setup, and applying fixes that ensure clean‑up after each test.
Stop leaving temporary files behind after tests. Learn how to use JUnit 5's @TempDir to automate the creation and cleanup of isolated test directories.
Stop duplicating test logic. Learn how to use JUnit 5 @ParameterizedTest, @ValueSource, and @MethodSource to decouple test data from logic and reduce boilerplate.
Learn how to set up and run JUnit 5 parameterized tests with @CsvSource, handle nulls, escape commas, and troubleshoot common pitfalls. A step‑by‑step guide with examples and validation tips.
JUnit 5's @ParameterizedTest replaces copy-pasted test methods with data-driven cases. Here's how to choose between @ValueSource, @CsvSource, and @MethodSource — and when plain tests are still better.
Shared mutable state in JUnit 5 @TestInstance(PER_CLASS) classes can cause flaky, order‑dependent failures. This guide offers a concise diagnostic table, step‑by‑step checks, targeted fixes, and escalation criteria to isolate and resolve the issue.
Stop duplicating test methods. Learn how to use JUnit 5's @ParameterizedTest with ValueSource, CsvSource, and MethodSource to increase edge-case coverage with less code.
Learn how to use JUnit 5 @TestFactory to generate test cases at runtime. This guide covers the architectural shift from static to dynamic testing for external data sources, including lifecycle constraints and operational verification.