Search in sources :

Example 1 with BundleStringResourceLoader

use of org.apache.wicket.resource.loader.BundleStringResourceLoader in project wicket by apache.

the class ApplicationSettingsTest method testOverrideStringResourceLoaderSetup.

/**
 */
@Test
public void testOverrideStringResourceLoaderSetup() {
    ResourceSettings settings = new ResourceSettings(new MockApplication());
    settings.getStringResourceLoaders().clear();
    settings.getStringResourceLoaders().add(new BundleStringResourceLoader("org.apache.wicket.resource.DummyResources"));
    settings.getStringResourceLoaders().add(new ComponentStringResourceLoader());
    List<IStringResourceLoader> loaders = settings.getStringResourceLoaders();
    Assert.assertEquals("There should be 2 overridden loaders", 2, loaders.size());
    Assert.assertTrue("First loader one should be the bundle one", loaders.get(0) instanceof BundleStringResourceLoader);
    Assert.assertTrue("Second loader should be the component one", loaders.get(1) instanceof ComponentStringResourceLoader);
}
Also used : ComponentStringResourceLoader(org.apache.wicket.resource.loader.ComponentStringResourceLoader) MockApplication(org.apache.wicket.mock.MockApplication) ResourceSettings(org.apache.wicket.settings.ResourceSettings) IStringResourceLoader(org.apache.wicket.resource.loader.IStringResourceLoader) BundleStringResourceLoader(org.apache.wicket.resource.loader.BundleStringResourceLoader) Test(org.junit.Test)

Example 2 with BundleStringResourceLoader

use of org.apache.wicket.resource.loader.BundleStringResourceLoader in project wicket by apache.

the class BundleStringResourceLoaderTest method loaderUnknownResources.

/**
 * @see org.apache.wicket.resource.StringResourceLoaderTestBase#testLoaderUnknownResources()
 */
@Override
@Test
public void loaderUnknownResources() {
    IStringResourceLoader loader = new BundleStringResourceLoader("unknown.resource");
    assertNull("Unknown resource should return null", loader.loadStringResource(component.getClass(), "test.string", Locale.getDefault(), null, null));
}
Also used : IStringResourceLoader(org.apache.wicket.resource.loader.IStringResourceLoader) BundleStringResourceLoader(org.apache.wicket.resource.loader.BundleStringResourceLoader) Test(org.junit.Test)

Aggregations

BundleStringResourceLoader (org.apache.wicket.resource.loader.BundleStringResourceLoader)2 IStringResourceLoader (org.apache.wicket.resource.loader.IStringResourceLoader)2 Test (org.junit.Test)2 MockApplication (org.apache.wicket.mock.MockApplication)1 ComponentStringResourceLoader (org.apache.wicket.resource.loader.ComponentStringResourceLoader)1 ResourceSettings (org.apache.wicket.settings.ResourceSettings)1