Class SystemPropertiesRule

All Implemented Interfaces:
org.junit.rules.TestRule, Executable, NameValuePairSetter<SystemProperties>, TestResource, SystemStubTestRule

public class SystemPropertiesRule extends SystemProperties implements SystemStubTestRule
Returns the system properties to their original state around each test block. Provides the ability for properties to be prepared before the test starts, via set(java.lang.String, java.lang.String).
Since:
1.0.0
  • Constructor Details

    • SystemPropertiesRule

      public SystemPropertiesRule()
      Default constructor provides restoration of properties
    • SystemPropertiesRule

      public SystemPropertiesRule(Properties properties)
      Construct with some properties to apply when active
      Parameters:
      properties - system properties to apply when active
    • SystemPropertiesRule

      public SystemPropertiesRule(String name, String value, String... nameValues)
      Construct with a variable number of properties that will be set when the rule is active
      Parameters:
      name - name of the first property
      value - value of the first property
      nameValues - pairs of name/values as Strings
  • Method Details