com.mockrunner.struts.MapMessageResourcesFactory Maven / Gradle / Ivy
package com.mockrunner.struts;
import java.util.Map;
import org.apache.struts.util.MessageResources;
import org.apache.struts.util.MessageResourcesFactory;
/**
* Factory for {@link MapMessageResources}.
* If you want this factory to be the default
* factory used in your actions in the tests,
* you should call
* MessageResourcesFactory.setFactoryClass("com.mockrunner.struts.MapMessageResourcesFactory")
*/
public class MapMessageResourcesFactory extends MessageResourcesFactory
{
private static Map theMessages;
/**
* Sets the messages Map
for returned
* {@link MapMessageResources} objects.
* @param messages the message Map
*/
public static void setMessageMap(Map messages)
{
theMessages = messages;
}
public MessageResources createResources(String config)
{
return new MapMessageResources(theMessages, this, config, this.returnNull);
}
}