public class SystemPropertiesRestoreRule extends Object implements org.junit.rules.TestRule
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.SystemPropertiesInvariantRule
,
ClassRule
,
Rule
Constructor and Description |
---|
SystemPropertiesRestoreRule()
Restores all properties.
|
SystemPropertiesRestoreRule(Map<String,String> setProperties)
Equivalent to calling
System.setProperty(String, String) on each of the provided
properties when the test starts. |
SystemPropertiesRestoreRule(Set<String> ignoredProperties) |
SystemPropertiesRestoreRule(String... ignoredProperties) |
SystemPropertiesRestoreRule(String key,
String value)
Equivalent to calling
System.setProperty(String, String) when the test starts. |
Modifier and Type | Method and Description |
---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement s,
org.junit.runner.Description d) |
public SystemPropertiesRestoreRule()
public SystemPropertiesRestoreRule(String key, String value)
System.setProperty(String, String)
when the test starts.public SystemPropertiesRestoreRule(Map<String,String> setProperties)
System.setProperty(String, String)
on each of the provided
properties when the test starts.public SystemPropertiesRestoreRule(Set<String> ignoredProperties)
ignoredProperties
- Properties that will be ignored (and will not be restored).public SystemPropertiesRestoreRule(String... ignoredProperties)
ignoredProperties
- Properties that will be ignored (and will not be restored).Copyright © 2011–2024 Carrot Search s.c.. All rights reserved.