public class EnvironmentVariableHelper
extends org.junit.rules.ExternalResource
Constructor and Description |
---|
EnvironmentVariableHelper() |
Modifier and Type | Method and Description |
---|---|
void |
remove(String key) |
void |
remove(SystemSetting setting) |
void |
reset() |
static void |
run(Consumer<EnvironmentVariableHelper> helperConsumer)
Static run method that allows for "single-use" environment variable modification.
|
void |
set(String key,
String value) |
void |
set(SystemSetting setting,
String value) |
public void remove(SystemSetting setting)
public void remove(String key)
public void set(SystemSetting setting, String value)
public void reset()
public static void run(Consumer<EnvironmentVariableHelper> helperConsumer)
EnvironmentVariableHelper.run(helper -> {
helper.set("variable", "value");
//run some test that uses "variable"
});
Will call reset()
at the end of the block (even if the block exits exceptionally).helperConsumer
- a code block to run that gets an EnvironmentVariableHelper
as an argumentCopyright © 2017 Amazon Web Services, Inc. All Rights Reserved.