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(String name,
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(String name,
Object object)
Add the given object to the list of JNDI objects that this template will expose.
|
Object |
lookup(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(String name, Object object)
name - the name the client is expected to look upobject - the object that will be returnedpublic void addObject(String name, Object object)
name - the name the client is expected to look upobject - the object that will be returnedpublic Object lookup(String name) throws NamingException
lookup in class org.springframework.jndi.JndiTemplateNamingException