public class TestLoggerExtension
extends java.lang.Object
implements org.junit.jupiter.api.extension.ParameterResolver, org.junit.jupiter.api.extension.AfterEachCallback, org.junit.jupiter.api.extension.BeforeEachCallback
TestLogger
as the capturing instance via LoggerUtils.enableCaptureWith(Logger)
,
disable capture
at the end of the test and injects the TestLogger
into the test case (by implementing ParameterResolver
).限定符和类型 | 类和说明 |
---|---|
static interface |
TestLoggerExtension.Capture
Set up a default
TestLoggerExtension , unless @TestLoggerExtension.Redirect annotation is also present. |
static interface |
TestLoggerExtension.Redirect
Set up a
TestLoggerExtension that routes log messages only to the injected TestLogger ,
suppressing the logs from the original logger. |
构造器和说明 |
---|
TestLoggerExtension() |
限定符和类型 | 方法和说明 |
---|---|
void |
afterEach(org.junit.jupiter.api.extension.ExtensionContext context) |
void |
beforeEach(org.junit.jupiter.api.extension.ExtensionContext context) |
java.lang.Object |
resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext,
org.junit.jupiter.api.extension.ExtensionContext extensionContext) |
boolean |
supportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext,
org.junit.jupiter.api.extension.ExtensionContext extensionContext) |
public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext context) throws java.lang.Exception
beforeEach
在接口中 org.junit.jupiter.api.extension.BeforeEachCallback
java.lang.Exception
public void afterEach(org.junit.jupiter.api.extension.ExtensionContext context) throws java.lang.Exception
afterEach
在接口中 org.junit.jupiter.api.extension.AfterEachCallback
java.lang.Exception
public boolean supportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionException
supportsParameter
在接口中 org.junit.jupiter.api.extension.ParameterResolver
org.junit.jupiter.api.extension.ParameterResolutionException
@Nullable public java.lang.Object resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionException
resolveParameter
在接口中 org.junit.jupiter.api.extension.ParameterResolver
org.junit.jupiter.api.extension.ParameterResolutionException