| java.lang.Object org.springframework.jndi.JndiTemplate org.springframework.mock.jndi.ExpectedLookupTemplate
ExpectedLookupTemplate | public class ExpectedLookupTemplate extends JndiTemplate (Code) | | Simple implementation of JndiTemplate interface that always returns
a given object. Very useful for testing. Effectively a mock object.
author: Rod Johnson author: Juergen Hoeller |
Constructor Summary | |
public | ExpectedLookupTemplate() Construct a new JndiTemplate that will always return given objects
for given names. | public | ExpectedLookupTemplate(String name, Object object) Construct a new JndiTemplate that will always return the
given object, but honour only requests for the given name. |
Method Summary | |
public void | addObject(String name, Object object) Add the given object to the list of JNDI objects that this
template will expose. | public Object | lookup(String name) If the name is the expected name specified in the constructor,
return the object provided in the constructor. |
ExpectedLookupTemplate | public ExpectedLookupTemplate(String name, Object object)(Code) | | Construct a new JndiTemplate that will always return the
given object, but honour only requests for the given name.
Parameters: name - the name the client is expected to look up Parameters: object - the object that will be returned |
addObject | public void addObject(String name, Object object)(Code) | | Add the given object to the list of JNDI objects that this
template will expose.
Parameters: name - the name the client is expected to look up Parameters: object - the object that will be returned |
lookup | public Object lookup(String name) throws NamingException(Code) | | If the name is the expected name specified in the constructor,
return the object provided in the constructor. If the name is
unexpected, a respective NamingException gets thrown.
|
Fields inherited from org.springframework.jndi.JndiTemplate | final protected Log logger(Code)(Java Doc)
|
|
|