Class SystemPropertiesRestoreRule
java.lang.Object
com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule
- All Implemented Interfaces:
org.junit.rules.TestRule
A
TestRule
which restores system properties from before the nested
Statement
.
This rule requires appropriate security permission to read and write
system properties (System.getProperties()
) if running under a security
manager.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionIgnored property keys. -
Constructor Summary
ConstructorsConstructorDescriptionRestores all properties.SystemPropertiesRestoreRule
(String... ignoredProperties) SystemPropertiesRestoreRule
(Set<String> ignoredProperties) -
Method Summary
Modifier and TypeMethodDescriptionorg.junit.runners.model.Statement
apply
(org.junit.runners.model.Statement s, org.junit.runner.Description d) cloneAsMap
(Properties properties) (package private) static void
-
Field Details
-
ignoredProperties
Ignored property keys.
-
-
Constructor Details
-
SystemPropertiesRestoreRule
public SystemPropertiesRestoreRule()Restores all properties. -
SystemPropertiesRestoreRule
- Parameters:
ignoredProperties
- Properties that will be ignored (and will not be restored).
-
SystemPropertiesRestoreRule
- Parameters:
ignoredProperties
- Properties that will be ignored (and will not be restored).
-
-
Method Details
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement s, org.junit.runner.Description d) - Specified by:
apply
in interfaceorg.junit.rules.TestRule
-
cloneAsMap
-
restore
-
systemPropertiesAsMap
-