@Test
public void shouldCompareAndRetrieveIdsToBeDownloadedFromServer() throws JSONException, IOException, HttpException {

    SharedPreferences sharedPreferences = RapidFtrApplication.getApplicationInstance().getSharedPreferences();
    sharedPreferences.edit().putLong(RapidFtrApplication.LAST_CHILD_SYNC, 0).commit();
    Child child1 = mock(Child.class);
    Child child2 = mock(Child.class);
    given(childRepository.toBeSynced()).willReturn(newArrayList(child1, child2));
    given(childSyncService.getIdsToDownload()).willReturn(Arrays.asList("qwerty0987", "abcd1234"));
    given(childSyncService.getRecord("qwerty0987")).willReturn(mock(Child.class));
    given(childSyncService.getRecord("abcd1234")).willReturn(mock(Child.class));
    syncAllDataAsyncTask.setContext(rapidFtrActivity);
    syncAllDataAsyncTask.execute();
    verify(formService).downloadPublishedFormSections();
    verify(childSyncService).sync(child1, currentUser);
    verify(childSyncService).sync(child2, currentUser);
    verify(childSyncService).getIdsToDownload();
    verify(childSyncService).getRecord("qwerty0987");
    verify(childSyncService).getRecord("abcd1234");
}