public class ConfigureJohnson
extends org.junit.rules.ExternalResource
implements org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.AfterEachCallback
TestRule that configures the Johnson framework before the test and tears it down
afterwards. You would typically configure it to run before and after your test class, as follows:
@ClassRule
public static final TestRule johnsonRule = ConfigureJohnson.withDefaultConfiguration();
Or if you want to run it before and after each test method, do this:
@Rule
public final TestRule johnsonRule = ConfigureJohnson.withDefaultConfiguration();
| Modifier and Type | Method and Description |
|---|---|
protected void |
after() |
void |
afterEach(org.junit.jupiter.api.extension.ExtensionContext extensionContext) |
protected void |
before() |
void |
beforeEach(org.junit.jupiter.api.extension.ExtensionContext extensionContext) |
static org.junit.rules.TestRule |
withConfiguration(String location)
Creates an instance of this rule in which Johnson uses the given configuration file.
|
static ConfigureJohnson |
withDefaultConfiguration()
Creates an instance of this rule in which Johnson uses the default configuration file, namely
"johnson-config.xml". |
@Nonnull public static ConfigureJohnson withDefaultConfiguration()
"johnson-config.xml".Johnson.initialize(String)@Nonnull public static org.junit.rules.TestRule withConfiguration(@Nonnull String location)
location - the location of the Johnson configurationJohnson.initialize(String)protected void before()
before in class org.junit.rules.ExternalResourceprotected void after()
after in class org.junit.rules.ExternalResourcepublic void afterEach(org.junit.jupiter.api.extension.ExtensionContext extensionContext)
throws Exception
afterEach in interface org.junit.jupiter.api.extension.AfterEachCallbackExceptionCopyright © 2002-2022 Atlassian. All Rights Reserved.