Class EnvironmentVariablesRule
- java.lang.Object
-
- uk.org.webcompere.systemstubs.resource.SingularTestResource
-
- uk.org.webcompere.systemstubs.environment.EnvironmentVariables
-
- uk.org.webcompere.systemstubs.rules.EnvironmentVariablesRule
-
- All Implemented Interfaces:
org.junit.rules.TestRule,Executable,NameValuePairSetter<EnvironmentVariables>,TestResource,SystemStubTestRule
public class EnvironmentVariablesRule extends EnvironmentVariables implements SystemStubTestRule
JUnit 4 rule which sets up the environment variables around whatever JUnit 4 is running- Since:
- 1.0.0
-
-
Constructor Summary
Constructors Constructor Description EnvironmentVariablesRule()Default constructor provides restoration of the environment and the ability to set valuesEnvironmentVariablesRule(String name, String value, String... others)Construct with variables that will be set when the rule is activeEnvironmentVariablesRule(Map<String,String> variables)Construct with some variables to apply when activeEnvironmentVariablesRule(Properties properties)Construct with some variables to apply when active
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EnvironmentVariablesRuleand(String name, String value)EnvironmentVariablesRuleremove(String name)EnvironmentVariablesRuleset(String name, String value)EnvironmentVariablesRuleset(Map<Object,Object> properties)-
Methods inherited from class uk.org.webcompere.systemstubs.environment.EnvironmentVariables
doSetup, doTeardown, getVariables
-
Methods inherited from class uk.org.webcompere.systemstubs.resource.SingularTestResource
isActive, setup, teardown
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface uk.org.webcompere.systemstubs.resource.Executable
execute
-
Methods inherited from interface uk.org.webcompere.systemstubs.resource.NameValuePairSetter
set
-
Methods inherited from interface uk.org.webcompere.systemstubs.rules.internal.SystemStubTestRule
apply
-
Methods inherited from interface uk.org.webcompere.systemstubs.resource.TestResource
execute, setup, teardown
-
-
-
-
Constructor Detail
-
EnvironmentVariablesRule
public EnvironmentVariablesRule()
Default constructor provides restoration of the environment and the ability to set values
-
EnvironmentVariablesRule
public EnvironmentVariablesRule(Properties properties)
Construct with some variables to apply when active- Parameters:
properties- map of variables to apply when active
-
EnvironmentVariablesRule
public EnvironmentVariablesRule(String name, String value, String... others)
Construct with variables that will be set when the rule is active- Parameters:
name- name of the first variablevalue- value of the first variableothers- pairs of name/values as Strings
-
-
Method Detail
-
and
public EnvironmentVariablesRule and(String name, String value)
- Overrides:
andin classEnvironmentVariables
-
set
public EnvironmentVariablesRule set(String name, String value)
- Specified by:
setin interfaceNameValuePairSetter<EnvironmentVariables>- Overrides:
setin classEnvironmentVariables
-
set
public EnvironmentVariablesRule set(Map<Object,Object> properties)
- Specified by:
setin interfaceNameValuePairSetter<EnvironmentVariables>
-
remove
public EnvironmentVariablesRule remove(String name)
- Specified by:
removein interfaceNameValuePairSetter<EnvironmentVariables>- Overrides:
removein classEnvironmentVariables
-
-