Class SystemPropertiesRestoreRule

java.lang.Object
com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule
All Implemented Interfaces:
org.junit.rules.TestRule

public class SystemPropertiesRestoreRule extends Object implements 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 Details

    • ignoredProperties

      private final HashSet<String> ignoredProperties
      Ignored property keys.
  • Constructor Details

    • SystemPropertiesRestoreRule

      public SystemPropertiesRestoreRule()
      Restores all properties.
    • SystemPropertiesRestoreRule

      public SystemPropertiesRestoreRule(Set<String> ignoredProperties)
      Parameters:
      ignoredProperties - Properties that will be ignored (and will not be restored).
    • SystemPropertiesRestoreRule

      public SystemPropertiesRestoreRule(String... ignoredProperties)
      Parameters:
      ignoredProperties - Properties that will be ignored (and will not be restored).
  • Method Details