All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mockrunner.struts.MapMessageResourcesFactory Maven / Gradle / Ivy

Go to download

Mockrunner is a lightweight framework for unit testing applications in the J2EE environment. It supports servlets, filters, tag classes and Struts actions. It includes a JDBC a JMS and a JCA test framework and can be used to test EJB based applications.

The newest version!
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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy