public class LogCaptureFeature extends SimpleFeature
LogCaptureFeature.FilterOn
or a custom one implementing LogCaptureFeature.Filter
class can be
provided with the annotation LogCaptureFeature.FilterWith
to select the log events to capture.
A LogCaptureFeature.Result
instance is to be injected with Inject
as an attribute of the test.
The method LogCaptureFeature.Result.assertHasEvent()
can then be called from test methods to check that
matching log calls (events) have been captured.Modifier and Type | Class and Description |
---|---|
static interface |
LogCaptureFeature.Filter |
static interface |
LogCaptureFeature.FilterOn |
static interface |
LogCaptureFeature.FilterWith |
class |
LogCaptureFeature.NoLogCaptureFilterException |
class |
LogCaptureFeature.Result |
Modifier and Type | Field and Description |
---|---|
protected org.apache.log4j.Appender |
logAppender |
protected LogCaptureFeature.Filter |
logCaptureFilter |
protected LogCaptureFeature.Result |
myResult |
protected org.apache.log4j.Logger |
rootLogger |
Constructor and Description |
---|
LogCaptureFeature() |
Modifier and Type | Method and Description |
---|---|
void |
afterMethodRun(FeaturesRunner runner,
org.junit.runners.model.FrameworkMethod method,
Object test)
After a test method was ran.
|
void |
afterTeardown(FeaturesRunner runner)
After the call of the @After methods
|
void |
beforeMethodRun(FeaturesRunner runner,
org.junit.runners.model.FrameworkMethod method,
Object test)
Before a test method is invoked.
|
void |
beforeSetup(FeaturesRunner runner)
Before entering in the @Before methods
|
void |
configure(FeaturesRunner runner,
com.google.inject.Binder binder)
Configures Guice bindings if any is required by the feature.
|
protected void |
disable() |
protected void |
enable(LogCaptureFeature.Filter filter) |
afterRun, beforeRun, initialize, start, stop, testCreated
protected LogCaptureFeature.Filter logCaptureFilter
protected final LogCaptureFeature.Result myResult
protected org.apache.log4j.Logger rootLogger
protected org.apache.log4j.Appender logAppender
public LogCaptureFeature()
public void configure(FeaturesRunner runner, com.google.inject.Binder binder)
RunnerFeature
configure
in interface RunnerFeature
configure
in class SimpleFeature
public void beforeSetup(FeaturesRunner runner) throws Exception
RunnerFeature
beforeSetup
in interface RunnerFeature
beforeSetup
in class SimpleFeature
Exception
public void afterTeardown(FeaturesRunner runner) throws Exception
RunnerFeature
afterTeardown
in interface RunnerFeature
afterTeardown
in class SimpleFeature
Exception
public void beforeMethodRun(FeaturesRunner runner, org.junit.runners.model.FrameworkMethod method, Object test) throws Exception
RunnerFeature
beforeMethodRun
in interface RunnerFeature
beforeMethodRun
in class SimpleFeature
Exception
public void afterMethodRun(FeaturesRunner runner, org.junit.runners.model.FrameworkMethod method, Object test) throws Exception
RunnerFeature
afterMethodRun
in interface RunnerFeature
afterMethodRun
in class SimpleFeature
Exception
protected void enable(LogCaptureFeature.Filter filter) throws InstantiationException, IllegalAccessException
filter
- InstantiationException
IllegalAccessException
protected void disable()
Copyright © 2016 Nuxeo SA. All rights reserved.