@Test public void testSyncEnabledWifi() 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); 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(); verify(call).enqueue(callbackCapture.capture()); HackerNewsItem item = mock(HackerNewsItem.class); when(item.getKids()).thenReturn(new long[]{2L, 3L}); callbackCapture.getValue().onResponse(null, Response.success(item)); verify(TestRestServiceFactory.hnRestService, times(3)).cachedItem(any()); }
@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);  }