avignon.loaders
Class TestLoader

java.lang.Object
  extended byavignon.loaders.TestLoader
All Implemented Interfaces:
TagLoader

public class TestLoader
extends java.lang.Object
implements TagLoader

This is a fake TagLoader used for unit testing. It can handle exactly one tag/name combination per instance.


Constructor Summary
TestLoader()
          Construct a TagLoader that will not match anything unless setHandler is used.
TestLoader(java.lang.String name, AvignonTagHandler tag)
          Construct a TagLoader that will return a specific AvignonTagHandler for a given name or null if the name does not match.
 
Method Summary
 boolean equals(java.lang.Object value)
          Very simple equals method.
 AvignonTagHandler findTagHandler(java.lang.String name)
          Returns the saved AvignnonTagHandler if the given name matches the saved tag name.
static void setHandler(java.lang.String name, AvignonTagHandler tag)
          Sets the handler to be returned for a given tag name.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestLoader

public TestLoader(java.lang.String name,
                  AvignonTagHandler tag)
Construct a TagLoader that will return a specific AvignonTagHandler for a given name or null if the name does not match.

Parameters:
name - Name of the tag to match.
tag - AvignonTagHandler to return if queried for the given tag name.

TestLoader

public TestLoader()
Construct a TagLoader that will not match anything unless setHandler is used.

Method Detail

setHandler

public static void setHandler(java.lang.String name,
                              AvignonTagHandler tag)
Sets the handler to be returned for a given tag name.

Parameters:
name - The name of the tag to match.
tag - The tag to return if the name is matched.

findTagHandler

public AvignonTagHandler findTagHandler(java.lang.String name)
Returns the saved AvignnonTagHandler if the given name matches the saved tag name.

Specified by:
findTagHandler in interface TagLoader
Parameters:
name - Name of the tag being searched for.
Returns:
The saved tag handler if the given name matches the saved name or null if it does not.

equals

public boolean equals(java.lang.Object value)
Very simple equals method. All TestLoaders are equal.

Parameters:
value - The object to test for equality.
Returns:
True if the given object is a TestLoader.

SourceForge.net Logo