Package com.atlassian.confluence
Class ConfigureJohnson
java.lang.Object
org.junit.rules.ExternalResource
com.atlassian.confluence.ConfigureJohnson
- All Implemented Interfaces:
org.junit.rules.TestRule
public class ConfigureJohnson
extends org.junit.rules.ExternalResource
A
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();
- Since:
- 6.6.0
-
Method Summary
Modifier and TypeMethodDescriptionprotected voidafter()protected voidbefore()static @NonNull org.junit.rules.TestRulewithConfiguration(@NonNull String location) Creates an instance of this rule in which Johnson uses the given configuration file.static @NonNull org.junit.rules.TestRulewithContext(@NonNull jakarta.servlet.ServletContext context) Creates an instance of this rule in which Johnson uses the given context.static @NonNull org.junit.rules.TestRuleCreates an instance of this rule in which Johnson uses the default configuration file, namely"johnson-config.xml".Methods inherited from class org.junit.rules.ExternalResource
apply
-
Method Details
-
withDefaultConfiguration
public static @NonNull org.junit.rules.TestRule withDefaultConfiguration()Creates an instance of this rule in which Johnson uses the default configuration file, namely"johnson-config.xml".- Returns:
- see above
- See Also:
-
withConfiguration
Creates an instance of this rule in which Johnson uses the given configuration file. Only one of context or configuration file location must be given.- Parameters:
location- the location of the Johnson configuration- Returns:
- see above
- See Also:
-
withContext
public static @NonNull org.junit.rules.TestRule withContext(@NonNull jakarta.servlet.ServletContext context) Creates an instance of this rule in which Johnson uses the given context. Only one of context or configuration file location must be given.- Parameters:
context-- Returns:
- see above
- See Also:
-
before
- Overrides:
beforein classorg.junit.rules.ExternalResource- Throws:
Throwable
-
after
protected void after()- Overrides:
afterin classorg.junit.rules.ExternalResource
-