public final class SystemPropertiesRule extends Object implements ExternalResource
This class is exposed by the
systemPropertiesRule() method of the TestSuite interface. Direct instantiation of this class should be avoided.
Other methods are also available in the TestSuite interface to set one
property.
| Constructor and Description |
|---|
SystemPropertiesRule(String... propertiesName)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
after()
Code to be done after.
|
void |
before()
Code to be done before
|
static TestRule |
setSystemPropertyBeforeTestAndRestoreAfter(String propertyName,
String propertyValue)
Set a system property before a test and ensure the correct restore.
|
static TestRule |
setSystemPropertyBeforeTestAndRestoreAfter(String propertyName,
java.util.function.Supplier<String> propertyValue)
Set a system property before a test and ensure the correct restore.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonEnd, onStartcomputeStatement, onAssumptionSkip, onError, onFailurepublic SystemPropertiesRule(String... propertiesName)
propertiesName - the property namesAlternate
method to have the new construction in favor of a more DSL language.public void before()
ExternalResourcebefore in interface ExternalResourcepublic void after()
ExternalResourceafter in interface ExternalResourcepublic static TestRule setSystemPropertyBeforeTestAndRestoreAfter(String propertyName, java.util.function.Supplier<String> propertyValue)
propertyName - the property namepropertyValue - the property valuepublic static TestRule setSystemPropertyBeforeTestAndRestoreAfter(String propertyName, String propertyValue)
propertyName - the property namepropertyValue - the property valueCopyright © 2014. All rights reserved.