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,
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, wait
onEnd, onStart
computeStatement, of, onAssumptionSkip, onEnd, onError, onFailure, onStart
public SystemPropertiesRule(String... propertiesName)
propertiesName
- the property namesAlternate
method to have the new construction in favor of a more DSL language.
public void before()
ExternalResource
before
in interface ExternalResource
public void after()
ExternalResource
after
in interface ExternalResource
public static TestRule setSystemPropertyBeforeTestAndRestoreAfter(String propertyName, Supplier<String> propertyValue)
propertyName
- the property namepropertyValue
- the property valuepublic static TestRule setSystemPropertyBeforeTestAndRestoreAfter(String propertyName, String propertyValue)
propertyName
- the property namepropertyValue
- the property valueCopyright © 2015 Powerunit. All rights reserved.