FileDocCategorySizeDatePackage
BeanSelectionProviderTest.javaAPI DocExample2203Mon Jul 23 13:26:24 BST 2007org.apache.struts2.config

BeanSelectionProviderTest

public class BeanSelectionProviderTest extends TestCase

Fields Summary
Constructors Summary
Methods Summary
public voidtestRegister()

        Locale.setDefault(Locale.US); // force to US locale as we also have _de and _da properties

        LocalizedTextUtil.clearDefaultResourceBundles();
        LocalizedTextUtil.addDefaultResourceBundle("org/apache/struts2/struts-messages");
        assertEquals("The form has already been processed or no token was supplied, please try again.", LocalizedTextUtil.findDefaultText("struts.messages.invalid.token", Locale.getDefault()));
        
        LocatableProperties props = new LocatableProperties();
        props.setProperty(StrutsConstants.STRUTS_CUSTOM_I18N_RESOURCES, "testmessages,testmessages2");
        
        new BeanSelectionProvider().register(new ContainerBuilder(), props);

        assertEquals("Replaced message for token tag", LocalizedTextUtil.findDefaultText("struts.messages.invalid.token", Locale.getDefault()));