@Test public void testSyncEnabledAnyConnection() throws IOException { Call<HackerNewsItem> call = mock(Call.class); when(call.execute()).thenThrow(IOException.class); when(TestRestServiceFactory.hnRestService.cachedItem(any())).thenReturn(call); when(TestRestServiceFactory.hnRestService.networkItem(any())).thenReturn(call); PreferenceManager.getDefaultSharedPreferences(service) .edit() .putString(service.getString(R.string.pref_offline_data), service.getString(R.string.offline_data_default)) .apply(); setNetworkType(ConnectivityManager.TYPE_MOBILE); syncScheduler.scheduleSync(service, "1"); adapter.onPerformSync(mock(Account.class), getLastSyncExtras(), null, null, null); verify(TestRestServiceFactory.hnRestService).cachedItem(any()); verify(TestRestServiceFactory.hnRestService).networkItem(any()); assertThat(syncPreferences.getAll()).isEmpty(); }
@Override public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) { createSyncDelegate().performSync(new SyncDelegate.Job(extras)); }
ItemSyncAdapter extends AbstractThreadedSyncAdapter { @Override public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) { createSyncDelegate().performSync(new SyncDelegate.Job(extras)); } }
ItemSyncAdapter extends AbstractThreadedSyncAdapter { @Override public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) { createSyncDelegate().performSync(new SyncDelegate.Job(extras)); } ItemSyncAdapter(Context context, RestServiceFactory factory,
                           ReadabilityClient readabilityClient); }
ItemSyncAdapter extends AbstractThreadedSyncAdapter { @Override public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) { createSyncDelegate().performSync(new SyncDelegate.Job(extras)); } ItemSyncAdapter(Context context, RestServiceFactory factory,
                           ReadabilityClient readabilityClient); @Override void onPerformSync(Account account, Bundle extras, String authority,
                              ContentProviderClient provider, SyncResult syncResult); }
ItemSyncAdapter extends AbstractThreadedSyncAdapter { @Override public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) { createSyncDelegate().performSync(new SyncDelegate.Job(extras)); } ItemSyncAdapter(Context context, RestServiceFactory factory,
                           ReadabilityClient readabilityClient); @Override void onPerformSync(Account account, Bundle extras, String authority,
                              ContentProviderClient provider, SyncResult syncResult);  }