org.apache.lucene.util

## Class TestRuleRestoreSystemProperties

- java.lang.Object
- - com.carrotsearch.randomizedtesting.rules.TestRuleAdapter
  - - org.apache.lucene.util.TestRuleRestoreSystemProperties

- All Implemented Interfaces:
    org.junit.rules.TestRule

      public class TestRuleRestoreSystemProperties
      extends com.carrotsearch.randomizedtesting.rules.TestRuleAdapter

  Restore a given set of system properties to a snapshot taken at the beginning of the rule. This is semantically similar to `SystemPropertiesRestoreRule` but the list of properties to restore must be provided explicitly (because the security manager prevents us from accessing the whole set of properties). All properties to be restored must have r/w property permission.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TestRuleRestoreSystemProperties(String... propertyNames)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `afterAlways(List<Throwable> errors)`
    `protected void` | `before()`

    - ### Methods inherited from class com.carrotsearch.randomizedtesting.rules.TestRuleAdapter

      `afterIfSuccessful, apply`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TestRuleRestoreSystemProperties

          public TestRuleRestoreSystemProperties(String... propertyNames)

  - ### Method Detail

    - #### before

          protected void before()
                         throws Throwable

      Overrides:
        `before` in class `com.carrotsearch.randomizedtesting.rules.TestRuleAdapter`
      Throws:
        `Throwable`

    - #### afterAlways

          protected void afterAlways(List<Throwable> errors)
                              throws Throwable

      Overrides:
        `afterAlways` in class `com.carrotsearch.randomizedtesting.rules.TestRuleAdapter`
      Throws:
        `Throwable`

Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.