# io.github.libtmux.junit5.TmuxExtension.TmuxExtension

- **Module:** io.github.libtmux.junit5.TmuxExtension
- **Package:** io.github.libtmux:libtmux
- **Language:** Java
- **Kind:** class
- **Source:** https://github.com/libtmux/libtmux-java/blob/c3517519ee799428a809ce6deb1708c8be289cd1/libtmux-junit5/src/main/java/io/github/libtmux/junit5/TmuxExtension.java#L47
- **Page:** https://libtmux.org/reference/java/io-github-libtmux-junit5-tmuxextension-tmuxextension/

Gives each test its own tmux server and guarantees it is gone afterwards.

<p>All state lives in the extension store, never in fields. JUnit reuses one declaratively
registered extension instance for every test in a class, so a field is shared state the moment
tests run in parallel, and one test's teardown then reaches another test's server.

<p>The server is started eagerly, before the test body, and the aggregate that owns it is
registered before any process exists. Registering afterwards leaves a window in which a failure
partway through setup leaks a running tmux that nothing is left holding.

<p>Teardown is driven from a lifecycle callback and the aggregate is also {@link AutoCloseable}
for the framework's own store handling. Relying on store auto-close alone is a silent dependency
on a configuration property: with it disabled that design releases nothing and reports nothing.
The aggregate closes exactly once, so either path alone is sufficient.

## Members

- `fixtureRoot` (method)
- `reapAbandoned` (method) — Ends every tmux server under {@code root} whose owning JVM is gone, and answers how many ended. Runs while other runs are using the same root, so it may only touch abandoned servers.
- `deleteTree` (method)
- `beforeEach` (method)
- `supportsParameter` (method)
- `resolveParameter` (method)
- `afterEach` (method)
- `Fixture` (class) — One test's server, socket and directory, released exactly once.
