public class ExpectedLookupTemplate
extends org.springframework.jndi.JndiTemplate
Very useful for testing. Effectively a mock object.
Constructor and Description |
---|
ExpectedLookupTemplate()
Construct a new JndiTemplate that will always return given objects for
given names.
|
ExpectedLookupTemplate(java.lang.String name,
java.lang.Object object)
Construct a new JndiTemplate that will always return the given object,
but honour only requests for the given name.
|
Modifier and Type | Method and Description |
---|---|
void |
addObject(java.lang.String name,
java.lang.Object object)
Add the given object to the list of JNDI objects that this template will expose.
|
java.lang.Object |
lookup(java.lang.String name)
If the name is the expected name specified in the constructor, return the
object provided in the constructor.
|
public ExpectedLookupTemplate()
addObject
calls.addObject(String, Object)
public ExpectedLookupTemplate(java.lang.String name, java.lang.Object object)
name
- the name the client is expected to look upobject
- the object that will be returnedpublic void addObject(java.lang.String name, java.lang.Object object)
name
- the name the client is expected to look upobject
- the object that will be returnedpublic java.lang.Object lookup(java.lang.String name) throws javax.naming.NamingException
lookup
in class org.springframework.jndi.JndiTemplate
javax.naming.NamingException