open class ExpectedLookupTemplate : JndiTemplate
Simple extension of the JndiTemplate class that always returns a given object.
Very useful for testing. Effectively a mock object.
Author
Rod Johnson
Author
Juergen Hoeller
ExpectedLookupTemplate()
Construct a new JndiTemplate that will always return given objects for given names. To be populated through ExpectedLookupTemplate(name: String, object: Any)
Construct a new JndiTemplate that will always return the given object, but honour only requests for the given name. |
open fun addObject(name: String, object: Any): Unit
Add the given object to the list of JNDI objects that this template will expose. |
|
open fun lookup(name: String): Any
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. |