use of org.javarosa.core.services.locale.Localizer in project javarosa by opendatakit.
the class LocalizerTest method testSetCurrentLocaleExists.
public void testSetCurrentLocaleExists() {
Localizer l = new Localizer();
final String TEST_LOCALE = "test";
l.addAvailableLocale(TEST_LOCALE);
l.setLocale(TEST_LOCALE);
if (!TEST_LOCALE.equals(l.getLocale())) {
fail("Did not properly set current locale");
}
}
use of org.javarosa.core.services.locale.Localizer 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
}
}
use of org.javarosa.core.services.locale.Localizer in project javarosa by opendatakit.
the class LocalizerTest method testAddLocale.
public void testAddLocale() {
Localizer l = new Localizer();
final String TEST_LOCALE = "test";
if (l.hasLocale(TEST_LOCALE)) {
fail("Localizer reports it contains non-existent locale");
}
boolean result = l.addAvailableLocale(TEST_LOCALE);
if (!result) {
fail("Localizer failed to add new locale");
}
if (!l.hasLocale(TEST_LOCALE)) {
fail("Localizer reports it does not contain newly added locale");
}
OrderedMap<String, String> localeData = l.getLocaleData(TEST_LOCALE);
if (localeData == null || localeData.size() != 0) {
fail("Newly created locale not empty (or undefined)");
}
}
use of org.javarosa.core.services.locale.Localizer in project javarosa by opendatakit.
the class LocalizerTest method testGetLocaleMap.
public void testGetLocaleMap() {
Localizer l = new Localizer();
final String TEST_LOCALE = "test";
l.addAvailableLocale(TEST_LOCALE);
if (!l.getLocaleMap(TEST_LOCALE).equals(l.getLocaleData(TEST_LOCALE))) {
fail();
}
}
use of org.javarosa.core.services.locale.Localizer in project javarosa by opendatakit.
the class LocalizerTest method testEmpty.
public void testEmpty() {
Localizer l = new Localizer();
String[] locales = l.getAvailableLocales();
if (locales == null || locales.length > 0) {
fail("New localizer not empty");
}
String currentLocale = l.getLocale();
if (currentLocale != null) {
fail("New localizer has locale set");
}
String defaultLocale = l.getDefaultLocale();
if (defaultLocale != null) {
fail("New localizer has default locale set");
}
}
Aggregations