TOPIC 17/2216 MINNOT STARTED

JUnit 5 set-up and clean-up methods, parameterized tests and disabled tests

Run one test with many inputs instead of copying it, set up and tidy once or every time, and skip a test with a reason instead of deleting it.

L1–L4 are part of the Pro pass

L0 Explain simply

Analogy: one exam question asked with three answer sheets. The desk is cleared before each sheet. If a question is withdrawn, the paper says why. You do not write the question three times.

Tom reuses a case with declared inputs while managing setup and intentional non-execution. A lifecycle method prepares or releases resources at its named boundary. stands for comma-separated values. A CSV source supplies parameterized cases. A is reported as not executed, not as passing behavior.

The exam sheets and stage-crew pictures are alternative reminders: prepare for each invocation, keep the expected answer explicit, and record why a scene or question is not being performed.

The picture has a limit. Lifecycle behavior depends on the selected instance mode and extensions. Input parsing can change the values before the test sees them; a disabled test supplies no evidence that its business assertion currently passes.

(SYNTHETIC / TRAINING ONLY: Daily List and every named person are invented.)

PLAIN WORDS · 4 in this section
reuses
uses again
parameterized
sending values apart from the command so they cannot alter
invocation
switching on the backup plan when the main system fails
parsing
reading text and splitting it into its parts

PICTURE IT

The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.

THE REAL JOB Manage Jupiter invocation and class lifecycles with meaningful parameterized and disabled-test outcomes.

  1. Crew
  2. Cards
  3. Crossed out
Stage crew

HOW THE PICTURE MAPS

How each part of the picture matches the software
In the pictureIn the software
The crew before each sceneA before-each method
Opening the theatre onceA before-all method
A cue card for each acting of one sceneA parameter value
A scene crossed out in the scriptA skipped test

WHERE THIS PICTURE STOPS

  • Class-level reuse can share mutable state; setup boundaries and cleanup ownership matter.
  • CSV parsing can change inputs, and disabled does not mean the behavioral assertion passed.

HOOK

Crew, cards, crossed out.

TELL A FRIEND

A crew, cue cards and a crossed-out scene.

OFTEN MIXED UP WITH JUnit 5 from zero: first tests, set-up methods and assertions. That topic writes the first tests and checks. This one removes copies with parameterized tests, adds once-only set-up and skips a test with a reason.

Sources & standards — 5 sources
  1. Implementation-specific

    JUnit 5.14.4 test instance lifecycle ↗ — JUnit team · Default per-method mode; per-class mode and non-static class callbacks; configurable defaults (selected actual primary passages read 7 November 2026; named JUnit5.14.4 or Surefire3.6.1 scope, not latest-version certification).

    Default per-method mode; per-class mode and non-static class callbacks; configurable defaults. Selected product/release guidance; not a universal project or employer policy. · Checked 2026-11-07

    Actual selected primary sections read. The active guide header selects5.14.4; version-picker entries and newer-version notice are not its version. CSV introductory prose discrepancy is explained against attribute semantics/default and concrete false example. Synthetic helper/data examples do not claim application validation. Isolated runtime tests, if reported, do not certify Maven or every JVM.

  2. Implementation-specific

    JUnit 5.14.4 disabling tests ↗ — JUnit team · Method-level disabling versus class instantiation and class-level callbacks (selected actual primary passages read 7 November 2026; named JUnit5.14.4 or Surefire3.6.1 scope, not latest-version certification).

    Method-level disabling versus class instantiation and class-level callbacks. Selected product/release guidance; not a universal project or employer policy. · Checked 2026-11-07

    Actual selected primary sections read. The active guide header selects5.14.4; version-picker entries and newer-version notice are not its version. CSV introductory prose discrepancy is explained against attribute semantics/default and concrete false example. Synthetic helper/data examples do not claim application validation. Isolated runtime tests, if reported, do not certify Maven or every JVM.

  3. Implementation-specific

    JUnit 5.14.4 parameterized tests ↗ — JUnit team · CSV source input parsing/table; invocation lifecycle and BeforeEach per invocation (selected actual primary passages read 7 November 2026; named JUnit5.14.4 or Surefire3.6.1 scope, not latest-version certification).

    CSV source input parsing/table; invocation lifecycle and BeforeEach per invocation. Selected product/release guidance; not a universal project or employer policy. · Checked 2026-11-07

    Actual selected primary sections read. The active guide header selects5.14.4; version-picker entries and newer-version notice are not its version. CSV introductory prose discrepancy is explained against attribute semantics/default and concrete false example. Synthetic helper/data examples do not claim application validation. Isolated runtime tests, if reported, do not certify Maven or every JVM.

  4. Implementation-specific

    JUnit 5.14.4 CsvSource API ↗ — JUnit team · Quoted/unquoted whitespace and empty fields; explicit boolean semantics/default and prose discrepancy (selected actual primary passages read 7 November 2026; named JUnit5.14.4 or Surefire3.6.1 scope, not latest-version certification).

    Quoted/unquoted whitespace and empty fields; explicit boolean semantics/default and prose discrepancy. Selected product/release guidance; not a universal project or employer policy. · Checked 2026-11-07

    Actual selected primary sections read. The active guide header selects5.14.4; version-picker entries and newer-version notice are not its version. CSV introductory prose discrepancy is explained against attribute semantics/default and concrete false example. Synthetic helper/data examples do not claim application validation. Isolated runtime tests, if reported, do not certify Maven or every JVM.

  5. Implementation-specific

    JUnit 5.14.4 annotations ↗ — JUnit team · Jupiter test and lifecycle annotation roles (selected actual primary passages read 7 November 2026; named JUnit5.14.4 or Surefire3.6.1 scope, not latest-version certification).

    Jupiter test and lifecycle annotation roles. Selected product/release guidance; not a universal project or employer policy. · Checked 2026-11-07

    Actual selected primary sections read. The active guide header selects5.14.4; version-picker entries and newer-version notice are not its version. CSV introductory prose discrepancy is explained against attribute semantics/default and concrete false example. Synthetic helper/data examples do not claim application validation. Isolated runtime tests, if reported, do not certify Maven or every JVM.

PRACTISE AND KEEP

Sources for this topic — 5 sources
  1. Implementation-specific

    JUnit 5.14.4 test instance lifecycle ↗ — JUnit team · Default per-method mode; per-class mode and non-static class callbacks; configurable defaults (selected actual primary passages read 7 November 2026; named JUnit5.14.4 or Surefire3.6.1 scope, not latest-version certification).

    Default per-method mode; per-class mode and non-static class callbacks; configurable defaults. Selected product/release guidance; not a universal project or employer policy. · Checked 2026-11-07

    Actual selected primary sections read. The active guide header selects5.14.4; version-picker entries and newer-version notice are not its version. CSV introductory prose discrepancy is explained against attribute semantics/default and concrete false example. Synthetic helper/data examples do not claim application validation. Isolated runtime tests, if reported, do not certify Maven or every JVM.

  2. Implementation-specific

    JUnit 5.14.4 disabling tests ↗ — JUnit team · Method-level disabling versus class instantiation and class-level callbacks (selected actual primary passages read 7 November 2026; named JUnit5.14.4 or Surefire3.6.1 scope, not latest-version certification).

    Method-level disabling versus class instantiation and class-level callbacks. Selected product/release guidance; not a universal project or employer policy. · Checked 2026-11-07

    Actual selected primary sections read. The active guide header selects5.14.4; version-picker entries and newer-version notice are not its version. CSV introductory prose discrepancy is explained against attribute semantics/default and concrete false example. Synthetic helper/data examples do not claim application validation. Isolated runtime tests, if reported, do not certify Maven or every JVM.

  3. Implementation-specific

    JUnit 5.14.4 parameterized tests ↗ — JUnit team · CSV source input parsing/table; invocation lifecycle and BeforeEach per invocation (selected actual primary passages read 7 November 2026; named JUnit5.14.4 or Surefire3.6.1 scope, not latest-version certification).

    CSV source input parsing/table; invocation lifecycle and BeforeEach per invocation. Selected product/release guidance; not a universal project or employer policy. · Checked 2026-11-07

    Actual selected primary sections read. The active guide header selects5.14.4; version-picker entries and newer-version notice are not its version. CSV introductory prose discrepancy is explained against attribute semantics/default and concrete false example. Synthetic helper/data examples do not claim application validation. Isolated runtime tests, if reported, do not certify Maven or every JVM.

  4. Implementation-specific

    JUnit 5.14.4 CsvSource API ↗ — JUnit team · Quoted/unquoted whitespace and empty fields; explicit boolean semantics/default and prose discrepancy (selected actual primary passages read 7 November 2026; named JUnit5.14.4 or Surefire3.6.1 scope, not latest-version certification).

    Quoted/unquoted whitespace and empty fields; explicit boolean semantics/default and prose discrepancy. Selected product/release guidance; not a universal project or employer policy. · Checked 2026-11-07

    Actual selected primary sections read. The active guide header selects5.14.4; version-picker entries and newer-version notice are not its version. CSV introductory prose discrepancy is explained against attribute semantics/default and concrete false example. Synthetic helper/data examples do not claim application validation. Isolated runtime tests, if reported, do not certify Maven or every JVM.

  5. Implementation-specific

    JUnit 5.14.4 annotations ↗ — JUnit team · Jupiter test and lifecycle annotation roles (selected actual primary passages read 7 November 2026; named JUnit5.14.4 or Surefire3.6.1 scope, not latest-version certification).

    Jupiter test and lifecycle annotation roles. Selected product/release guidance; not a universal project or employer policy. · Checked 2026-11-07

    Actual selected primary sections read. The active guide header selects5.14.4; version-picker entries and newer-version notice are not its version. CSV introductory prose discrepancy is explained against attribute semantics/default and concrete false example. Synthetic helper/data examples do not claim application validation. Isolated runtime tests, if reported, do not certify Maven or every JVM.

Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.