AllSettings { public String fetchPreviousFetchIndex() { return settingsRepository.querySetting(PREVIOUS_FETCH_INDEX_SETTING_KEY, "0"); } AllSettings(AllSharedPreferences preferences, SettingsRepository settingsRepository); void registerANM(String userName, String password); void savePreviousFetchIndex(String value); String fetchPreviousFetchIndex(); void saveAppliedVillageFilter(String village); String appliedVillageFilter(String defaultFilterValue); String fetchANMPassword(); String fetchPreviousFormSyncIndex(); void savePreviousFormSyncIndex(String value); void saveANMLocation(String anmLocation); String fetchANMLocation(); static final String APPLIED_VILLAGE_FILTER_SETTING_KEY; static final String PREVIOUS_FETCH_INDEX_SETTING_KEY; static final String PREVIOUS_FORM_SYNC_INDEX_SETTING_KEY; }
@Test public void shouldFetchPreviousFetchIndex() throws Exception { when(settingsRepository.querySetting("previousFetchIndex", "0")).thenReturn("1234"); String actual = allSettings.fetchPreviousFetchIndex(); verify(settingsRepository).querySetting("previousFetchIndex", "0"); assertEquals("1234", actual); }