public class ExpectedLookupTemplate extends JndiTemplate
Very useful for testing. Effectively a mock object.
logger| 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. 
 | 
bind, createInitialContext, execute, getContext, getEnvironment, lookup, rebind, releaseContext, setEnvironment, unbindpublic 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 JndiTemplatename - the JNDI name of the objectnull; if a not so well-behaved
 JNDI implementations returns null, a NamingException gets thrown)NamingException - if there is no object with the given
 name bound to JNDI