In the DeviceSettingsFragment test whenDefaultLocalePreferenceScreenIsClicked_doChangeLanguage(), it
requires a list of locales as entries in the list preference dialog, however, the data isn’t static or provided by a datastore. It is a custom class that uses AsyncTask to fetch I/O data from odk internal file (path:app_name/assets/commonDefinitions.js) and parses it to return locales in the form of List<Map<String, Object>>.
To solve it, either:
- use power mock to mock this static LocalizationUtils.getCommonLocales method, however, power mock doesn’t currently run in android tests - java.lang.NoClassDefFoundError: Failed resolution of: Ljava/beans/Introspector; · Issue #1062 · powermock/powermock · GitHub
- create a file on my own with the dummy contents so locale can be set Since the fragment directly accesses the preferences screen and it, in turn, creates the CommonTranslationsLocaleScreen instance, there’s no other way around it
It would be of great help to me if I can get to know how should I proceed to solve this issue. @W_Brunette @Love @bengreen