org.springunit.framework
Class SpringUnitContext<T>

java.lang.Object
  extended by org.springunit.framework.SpringUnitContext<T>

public class SpringUnitContext<T>
extends Object

A bean that holds data for a single SpringUnitTest.
The bean contains a single attribute, data, that is a map of strings to objects. The string keys are either the names of tests or arbitrary identifiers for data values. For keys that name tests, the corresponding value is itself a map of string keys to object values.

Author:
Ted Velkoff

Constructor Summary
SpringUnitContext()
           
 
Method Summary
 Map<? extends String,? extends T> getData()
          Test data values associated with a TestCase.
 T getObject(String key, String fName)
          Find the data value identified by key, searching first in the scope of the name of the test (fName), then outward until found or null is returned.
protected  T getObject(String key, String fName, Map<? extends String,? extends T> map)
          Find the data value identified by key in the map by searching first in the scope of the test (fName).
 void setData(Map<? extends String,? extends T> data)
          Make data the test data values associcated with TestCase.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpringUnitContext

public SpringUnitContext()
Method Detail

getData

public Map<? extends String,? extends T> getData()
Test data values associated with a TestCase. By convention, keys of the form "testXxx" have associated values of the type Map. All such elements comprise data items in the scope of the test having the same name as the key. Keys of any other form have values of type T, and represent data in the scope of the test case.

Returns:
Map

getObject

public T getObject(String key,
                   String fName)
Find the data value identified by key, searching first in the scope of the name of the test (fName), then outward until found or null is returned.

Parameters:
key - Identifier of data value to be found
fName - Name of test in whose scope search should begin
Returns:
Object of type T if found, null otherwise

setData

public void setData(Map<? extends String,? extends T> data)
Make data the test data values associcated with TestCase.

Parameters:
data - Data values indexed by string names

getObject

protected T getObject(String key,
                      String fName,
                      Map<? extends String,? extends T> map)
Find the data value identified by key in the map by searching first in the scope of the test (fName). If fName is the name of a map testMap contained in map, then return the value in testMap associated with key. If there is no value in testMap associated with key, then return the value associated with key in map, which could be null.

Parameters:
key - Identifier of data value
fName - Identifier of test; must exactly match the name of a test procedure in a SpringUnitTest.
map - Map of string identifiers to objects where the string is either an fName or a key
Returns:
Object of type T if found, otherwise null


Copyright © 2007 null. All Rights Reserved.