Search in sources :

Example 1 with UnregisteredLocaleException

use of org.javarosa.core.util.UnregisteredLocaleException in project javarosa by opendatakit.

the class LocalizerTest method testGetLocaleMapNotExist.

public void testGetLocaleMapNotExist() {
    Localizer l = new Localizer();
    final String TEST_LOCALE = "test";
    try {
        l.getLocaleMap(TEST_LOCALE);
        fail("Did not throw exception when getting locale mapping for non-existent locale");
    } catch (UnregisteredLocaleException nsee) {
    // expected
    }
}
Also used : Localizer(org.javarosa.core.services.locale.Localizer) UnregisteredLocaleException(org.javarosa.core.util.UnregisteredLocaleException)

Example 2 with UnregisteredLocaleException

use of org.javarosa.core.util.UnregisteredLocaleException in project javarosa by opendatakit.

the class LocalizerTest method testUnsetCurrentLocale.

public void testUnsetCurrentLocale() {
    Localizer l = new Localizer();
    final String TEST_LOCALE = "test";
    l.addAvailableLocale(TEST_LOCALE);
    l.setLocale(TEST_LOCALE);
    try {
        l.setLocale(null);
        fail("Able to unset current locale");
    } catch (UnregisteredLocaleException nsee) {
    // expected
    }
}
Also used : Localizer(org.javarosa.core.services.locale.Localizer) UnregisteredLocaleException(org.javarosa.core.util.UnregisteredLocaleException)

Example 3 with UnregisteredLocaleException

use of org.javarosa.core.util.UnregisteredLocaleException in project javarosa by opendatakit.

the class LocalizerTest method testSetCurrentLocaleNotExists.

public void testSetCurrentLocaleNotExists() {
    Localizer l = new Localizer();
    final String TEST_LOCALE = "test";
    try {
        l.setLocale(TEST_LOCALE);
        fail("Set current locale to a non-existent locale");
    } catch (UnregisteredLocaleException nsee) {
    // expected
    }
}
Also used : Localizer(org.javarosa.core.services.locale.Localizer) UnregisteredLocaleException(org.javarosa.core.util.UnregisteredLocaleException)

Example 4 with UnregisteredLocaleException

use of org.javarosa.core.util.UnregisteredLocaleException in project javarosa by opendatakit.

the class LocalizerTest method testSetDefaultLocaleNotExists.

public void testSetDefaultLocaleNotExists() {
    Localizer l = new Localizer();
    final String TEST_LOCALE = "test";
    try {
        l.setDefaultLocale(TEST_LOCALE);
        fail("Set current locale to a non-existent locale");
    } catch (UnregisteredLocaleException nsee) {
    // expected
    }
}
Also used : Localizer(org.javarosa.core.services.locale.Localizer) UnregisteredLocaleException(org.javarosa.core.util.UnregisteredLocaleException)

Example 5 with UnregisteredLocaleException

use of org.javarosa.core.util.UnregisteredLocaleException in project javarosa by opendatakit.

the class LocalizerTest method testUnsetDefaultLocale.

public void testUnsetDefaultLocale() {
    Localizer l = new Localizer();
    final String TEST_LOCALE = "test";
    l.addAvailableLocale(TEST_LOCALE);
    l.setDefaultLocale(TEST_LOCALE);
    try {
        l.setDefaultLocale(null);
        if (l.getDefaultLocale() != null) {
            fail("Could not unset default locale");
        }
    } catch (UnregisteredLocaleException nsee) {
        fail("Exception unsetting default locale");
    }
}
Also used : Localizer(org.javarosa.core.services.locale.Localizer) UnregisteredLocaleException(org.javarosa.core.util.UnregisteredLocaleException)

Aggregations

Localizer (org.javarosa.core.services.locale.Localizer)7 UnregisteredLocaleException (org.javarosa.core.util.UnregisteredLocaleException)7 TableLocaleSource (org.javarosa.core.services.locale.TableLocaleSource)2