net.sourceforge.groboutils.junit.v1
Class SysPropertiesUtil

java.lang.Object
  extended bynet.sourceforge.groboutils.junit.v1.SysPropertiesUtil

public class SysPropertiesUtil
extends java.lang.Object

Utility that allows for easy setting and reseting of System properties. Some classes that need testing may depend upon a System property setting, and this class will help testing that. This is JDK 1.1 and above compatible.

Each instance of this utility should be created in the setUp() method of the test case, then the utility should have its reset() method called in the tearDown() method. This ensures that the standard system properties have been set correctly.

Since:
December 26, 2002
Version:
$Date: 2003/07/21 13:57:54 $
Author:
Matt Albrecht groboclown@users.sourceforge.net

Constructor Summary
SysPropertiesUtil()
          Each instance should be an instance variable for a test class, and it should be created in the setUp() method.
 
Method Summary
 void reset()
          Resets the system properties to the way they were when this class was created.
 void setValue(java.lang.String key, java.lang.String newVal)
          Sets the system property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SysPropertiesUtil

public SysPropertiesUtil()
Each instance should be an instance variable for a test class, and it should be created in the setUp() method.

Method Detail

setValue

public void setValue(java.lang.String key,
                     java.lang.String newVal)
Sets the system property. If the new value is null, then the property, if it exists, will be removed. If the key is null, then an IllegalArgumentException will be thrown.


reset

public void reset()
Resets the system properties to the way they were when this class was created.



Copyright © 2001-2003 by The GroboUtils Project