BackupJobs { public @Nullable Job scheduleIncoming() { return schedule(preferences.getIncomingTimeoutSecs(), INCOMING, false); } 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 shouldScheduleIncoming() throws Exception { when(preferences.isAutoBackupEnabled()).thenReturn(true); when(preferences.getIncomingTimeoutSecs()).thenReturn(2000); Job job = subject.scheduleIncoming(); verifyJobScheduled(job, 2000, "INCOMING"); }
@Test public void shouldNotScheduleIncomingBackupIfAutoBackupIsDisabled() throws Exception { when(preferences.isAutoBackupEnabled()).thenReturn(false); assertThat(subject.scheduleIncoming()).isEqualTo(null); }