junit.extensions
Class ConfigurableTestCase

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--junit.extensions.ConfigurableTestCase
All Implemented Interfaces:
ConfigurableTest, junit.framework.Test

public class ConfigurableTestCase
extends junit.framework.TestCase
implements ConfigurableTest

Base class for test cases which are configured using a configuration file instead of hardcoding test data in the fixture.

Author:
Siegfried GOESCHL, Dima STADNIK

Field Summary
protected  Configuration conf
          Cached configuration.
 
Constructor Summary
ConfigurableTestCase(java.lang.String name)
          Creates instance of configurable test case.
 
Method Summary
 boolean getBoolean(java.lang.String key)
          Retrieves boolean number from configuration.
 byte getByte(java.lang.String key)
          Retrieves byte from configuration.
 char getChar(java.lang.String key)
          Retrieves character from configuration.
protected  Configuration getConfiguration()
          Retrieves configuration of this test case.
 double getDouble(java.lang.String key)
          Retrieves double number from configuration.
 float getFloat(java.lang.String key)
          Retrieves float number from configuration.
 int getInteger(java.lang.String key)
          Retrieves integer number from configuration.
 long getLong(java.lang.String key)
          Retrieves long number from configuration.
 short getShort(java.lang.String key)
          Retrieves short number from configuration.
 java.lang.String getString(java.lang.String key)
          Retrieves string from configuration.
 java.lang.String[] getStrings(java.lang.String key)
          Retrieves array of strings from configuration.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface junit.framework.Test
countTestCases, run
 

Field Detail

conf

protected Configuration conf
Cached configuration.
Constructor Detail

ConfigurableTestCase

public ConfigurableTestCase(java.lang.String name)
Creates instance of configurable test case.
Parameters:
name - Name of this test case.
Method Detail

getConfiguration

protected Configuration getConfiguration()
Retrieves configuration of this test case.
Returns:
Configuration of this test case.

getBoolean

public boolean getBoolean(java.lang.String key)
                   throws java.lang.IllegalArgumentException
Description copied from interface: ConfigurableTest
Retrieves boolean number from configuration.
Specified by:
getBoolean in interface ConfigurableTest
Following copied from interface: junit.extensions.ConfigurableTest
Parameters:
key - Configuration parameter name.
Returns:
Boolean value of configuration parameter.
Throws:
java.lang.IllegalArgumentException - Parameter was not found or can't be retrieved.

getByte

public byte getByte(java.lang.String key)
             throws java.lang.IllegalArgumentException
Description copied from interface: ConfigurableTest
Retrieves byte from configuration.
Specified by:
getByte in interface ConfigurableTest
Following copied from interface: junit.extensions.ConfigurableTest
Parameters:
key - Configuration parameter name.
Returns:
Byte value of configuration parameter.
Throws:
java.lang.IllegalArgumentException - Parameter was not found or can't be retrieved.

getChar

public char getChar(java.lang.String key)
             throws java.lang.IllegalArgumentException
Description copied from interface: ConfigurableTest
Retrieves character from configuration.
Specified by:
getChar in interface ConfigurableTest
Following copied from interface: junit.extensions.ConfigurableTest
Parameters:
key - Configuration parameter name.
Returns:
Char value of configuration parameter.
Throws:
java.lang.IllegalArgumentException - Parameter was not found or can't be retrieved.

getDouble

public double getDouble(java.lang.String key)
                 throws java.lang.IllegalArgumentException
Description copied from interface: ConfigurableTest
Retrieves double number from configuration.
Specified by:
getDouble in interface ConfigurableTest
Following copied from interface: junit.extensions.ConfigurableTest
Parameters:
key - Configuration parameter name.
Returns:
Double value of configuration parameter.
Throws:
java.lang.IllegalArgumentException - Parameter was not found or can't be retrieved.

getFloat

public float getFloat(java.lang.String key)
               throws java.lang.IllegalArgumentException
Description copied from interface: ConfigurableTest
Retrieves float number from configuration.
Specified by:
getFloat in interface ConfigurableTest
Following copied from interface: junit.extensions.ConfigurableTest
Parameters:
name - Configuration parameter name.
Returns:
Float value of configuration parameter.
Throws:
java.lang.IllegalArgumentException - Parameter was not found or can't be retrieved.

getInteger

public int getInteger(java.lang.String key)
               throws java.lang.IllegalArgumentException
Description copied from interface: ConfigurableTest
Retrieves integer number from configuration.
Specified by:
getInteger in interface ConfigurableTest
Following copied from interface: junit.extensions.ConfigurableTest
Parameters:
key - Configuration parameter name.
Returns:
Integer value of configuration parameter.
Throws:
java.lang.IllegalArgumentException - Parameter was not found or can't be retrieved.

getLong

public long getLong(java.lang.String key)
             throws java.lang.IllegalArgumentException
Description copied from interface: ConfigurableTest
Retrieves long number from configuration.
Specified by:
getLong in interface ConfigurableTest
Following copied from interface: junit.extensions.ConfigurableTest
Parameters:
key - Configuration parameter name.
Returns:
Long value of configuration parameter.
Throws:
java.lang.IllegalArgumentException - Parameter was not found or can't be retrieved.

getShort

public short getShort(java.lang.String key)
               throws java.lang.IllegalArgumentException
Description copied from interface: ConfigurableTest
Retrieves short number from configuration.
Specified by:
getShort in interface ConfigurableTest
Following copied from interface: junit.extensions.ConfigurableTest
Parameters:
key - Configuration parameter name.
Returns:
Short value of configuration parameter.
Throws:
java.lang.IllegalArgumentException - Parameter was not found or can't be retrieved.

getString

public java.lang.String getString(java.lang.String key)
                           throws java.lang.IllegalArgumentException
Description copied from interface: ConfigurableTest
Retrieves string from configuration.
Specified by:
getString in interface ConfigurableTest
Following copied from interface: junit.extensions.ConfigurableTest
Parameters:
key - Configuration parameter name.
Returns:
String value of configuration parameter.
Throws:
java.lang.IllegalArgumentException - Parameter was not found or can't be retrieved.

getStrings

public java.lang.String[] getStrings(java.lang.String key)
                              throws java.lang.IllegalArgumentException
Description copied from interface: ConfigurableTest
Retrieves array of strings from configuration.
Specified by:
getStrings in interface ConfigurableTest
Following copied from interface: junit.extensions.ConfigurableTest
Parameters:
key - Configuration parameter name.
Returns:
Value of configuration parameter as array of strings.
Throws:
java.lang.IllegalArgumentException - Parameter was not found or can't be retrieved.


Copyright © 2001-2002 IT20one GmbH. All Rights Reserved.