# 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/842228310449e879ebcaa3f910597757c9dbffd6/libtmux-junit5/src/main/java/io/github/libtmux/junit5/TmuxExtension.java#L47
- **Page:** https://libtmux.org/en/java/latest/reference/io-github-libtmux-junit5-tmuxextension-tmuxextension/

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

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.

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.

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.
