BackupJobs { public @Nullable Job scheduleContentTriggerJob() { return schedule(createContentUriTriggerJob()); } BackupJobs(Context context);   BackupJobs(Context context, Preferences preferences); @Nullable Job scheduleIncoming(); Job scheduleRegular(); @Nullable Job scheduleContentTriggerJob(); @Nullable Job scheduleBootup(); @Nullable Job scheduleImmediate(); void cancelAll(); void cancelRegular();  }
@Test public void shouldScheduleContentUriTriggerForSMS() throws Exception { Job job = subject.scheduleContentTriggerJob(); assertThat(job.getTrigger()).isInstanceOf(JobTrigger.ContentUriTrigger.class); JobTrigger.ContentUriTrigger contentUriTrigger = (JobTrigger.ContentUriTrigger) job.getTrigger(); assertThat(contentUriTrigger.getUris()).containsExactly(new ObservedUri(SMS_PROVIDER, FLAG_NOTIFY_FOR_DESCENDANTS)); }
@Test public void shouldScheduleContentUriTriggerForCallLogIfEnabled() throws Exception { when(preferences.isCallLogBackupAfterCallEnabled()).thenReturn(true); when(dataTypePreferences.isBackupEnabled(CALLLOG)).thenReturn(true); Job job = subject.scheduleContentTriggerJob(); assertThat(job.getTrigger()).isInstanceOf(JobTrigger.ContentUriTrigger.class); JobTrigger.ContentUriTrigger contentUriTrigger = (JobTrigger.ContentUriTrigger) job.getTrigger(); assertThat(contentUriTrigger.getUris()).containsExactly( new ObservedUri(SMS_PROVIDER, FLAG_NOTIFY_FOR_DESCENDANTS), new ObservedUri(CALLLOG_PROVIDER, FLAG_NOTIFY_FOR_DESCENDANTS) ); }