Search in sources :

Example 1 with DatePickerLanguages

use of org.odlabs.wiquery.ui.datepicker.DatePickerLanguageResourceReference.DatePickerLanguages in project wiquery by WiQuery.

the class DatePickerLanguageResourceReferenceTestCase method testGetDatePickerLanguages.

@Test
public void testGetDatePickerLanguages() {
    Locale nonavailableLocale = new Locale("wiquery");
    Locale availableLocale = DatePickerLanguages.ARMENIAN.getLocale();
    assertNull(DatePickerLanguages.getDatePickerLanguages(nonavailableLocale));
    assertNull(DatePickerLanguageResourceReference.get(nonavailableLocale));
    assertNotNull(DatePickerLanguages.getDatePickerLanguages(availableLocale));
    assertNotNull(DatePickerLanguageResourceReference.get(availableLocale));
    for (DatePickerLanguages language : DatePickerLanguages.values()) {
        // assert if the language getter is implemented correctly to return
        // the exact variant.
        assertEquals(language, DatePickerLanguages.getDatePickerLanguages(language.getLocale()));
        // assert if the reference getter is implemented correctly to return
        // a reference to the exact variant.
        DatePickerLanguageResourceReference ref = DatePickerLanguageResourceReference.get(language.getLocale());
        assertNotNull(ref);
        // assert if the file is actually there.
        IResourceStreamLocator locator = Application.get().getResourceSettings().getResourceStreamLocator();
        String absolutePath = Packages.absolutePath(DatePickerLanguageResourceReference.class, DatePickerLanguages.getJsFileName(language));
        assertNotNull("Resource " + DatePickerLanguages.getJsFileName(language) + " for locale " + language.getLocale() + " does not exist!", locator.locate(DatePickerLanguageResourceReference.class, absolutePath));
    }
}
Also used : Locale(java.util.Locale) IResourceStreamLocator(org.apache.wicket.core.util.resource.locator.IResourceStreamLocator) DatePickerLanguages(org.odlabs.wiquery.ui.datepicker.DatePickerLanguageResourceReference.DatePickerLanguages) Test(org.junit.Test)

Aggregations

Locale (java.util.Locale)1 IResourceStreamLocator (org.apache.wicket.core.util.resource.locator.IResourceStreamLocator)1 Test (org.junit.Test)1 DatePickerLanguages (org.odlabs.wiquery.ui.datepicker.DatePickerLanguageResourceReference.DatePickerLanguages)1