public class SystemPropertyOverrides
extends java.lang.Object
implements java.lang.AutoCloseable
System.setProperty(String, String)). By using this class within try-with-resources,
the test can be assured that any property set will be restored to its initial state after the
test completes (success & failure).| Constructor and Description |
|---|
SystemPropertyOverrides() |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
setProperty(java.lang.String key,
java.lang.String value)
Sets a system property (by calling
System.setProperty(String, String)) while
backing up the original value and replacing it once this class is closed. |
public void setProperty(@NonNull
java.lang.String key,
java.lang.String value)
System.setProperty(String, String)) while
backing up the original value and replacing it once this class is closed.public void close()
throws java.lang.Exception
close in interface java.lang.AutoCloseablejava.lang.Exception