Class 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 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