Class LightkeeperExtension
- All Implemented Interfaces:
org.junit.jupiter.api.extension.AfterAllCallback,org.junit.jupiter.api.extension.AfterEachCallback,org.junit.jupiter.api.extension.BeforeAllCallback,org.junit.jupiter.api.extension.BeforeEachCallback,org.junit.jupiter.api.extension.Extension,org.junit.jupiter.api.extension.ParameterResolver,org.junit.jupiter.api.extension.TestInstantiationAwareExtension
On test failure the extension writes a diagnostics bundle (test outcome, captured server errors, server
console output) before any cleanup runs — see FailureDiagnosticsWriter. Two system properties control
this: lightkeeper.diagnostics (on-failure (default) | always | off) and
lightkeeper.diagnosticsDirectory (default target/lightkeeper-reports, resolved against the
test JVM's working directory).
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.junit.jupiter.api.extension.TestInstantiationAwareExtension
org.junit.jupiter.api.extension.TestInstantiationAwareExtension.ExtensionContextScope -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterAll(org.junit.jupiter.api.extension.ExtensionContext context) Closes shared framework state after all tests in the class.voidafterEach(org.junit.jupiter.api.extension.ExtensionContext context) Cleans up method-scoped framework resources after each test method.voidbeforeAll(org.junit.jupiter.api.extension.ExtensionContext context) Starts a shared framework when tests are not configured for per-method fresh servers.voidbeforeEach(org.junit.jupiter.api.extension.ExtensionContext context) Starts or scopes framework state before each test method.resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) Resolves an active framework instance for parameter injection.booleansupportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) Supports injection ofILightkeeperFrameworkparameters.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.junit.jupiter.api.extension.TestInstantiationAwareExtension
getTestInstantiationExtensionContextScope
-
Constructor Details
-
LightkeeperExtension
public LightkeeperExtension()
-
-
Method Details
-
beforeAll
public void beforeAll(org.junit.jupiter.api.extension.ExtensionContext context) Starts a shared framework when tests are not configured for per-method fresh servers.Also validates the diagnostics configuration up front: a typo in
lightkeeper.diagnosticsmust fail loudly here, before any server is provisioned — not during cleanup.- Specified by:
beforeAllin interfaceorg.junit.jupiter.api.extension.BeforeAllCallback
-
beforeEach
public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext context) Starts or scopes framework state before each test method.- Specified by:
beforeEachin interfaceorg.junit.jupiter.api.extension.BeforeEachCallback
-
afterEach
public void afterEach(org.junit.jupiter.api.extension.ExtensionContext context) Cleans up method-scoped framework resources after each test method.Diagnostics are captured first: JUnit's
TestWatcherhooks only run after allafterEachcallbacks, by which point the framework is closed (fresh mode) or its error capture cleared (shared mode) — so this is the last moment the failing test's state is still observable.- Specified by:
afterEachin interfaceorg.junit.jupiter.api.extension.AfterEachCallback
-
afterAll
public void afterAll(org.junit.jupiter.api.extension.ExtensionContext context) Closes shared framework state after all tests in the class.- Specified by:
afterAllin interfaceorg.junit.jupiter.api.extension.AfterAllCallback
-
supportsParameter
public boolean supportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionException Supports injection ofILightkeeperFrameworkparameters.- Specified by:
supportsParameterin interfaceorg.junit.jupiter.api.extension.ParameterResolver- Throws:
org.junit.jupiter.api.extension.ParameterResolutionException
-
resolveParameter
public Object resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionException Resolves an active framework instance for parameter injection.- Specified by:
resolveParameterin interfaceorg.junit.jupiter.api.extension.ParameterResolver- Throws:
org.junit.jupiter.api.extension.ParameterResolutionException
-