JobDispatcher { void reschedule(@NonNull JobInfo jobInfo, @Nullable Bundle extras) { try { getScheduler().reschedule(context, jobInfo, getScheduleId(jobInfo.getId()), extras); } catch (SchedulerException e) { Logger.error(e, "Scheduler failed to schedule jobInfo"); if (useFallbackScheduler()) { reschedule(jobInfo, extras); } } } private  JobDispatcher(@NonNull Context context); @VisibleForTesting  JobDispatcher(@NonNull Context context, SchedulerFactory schedulerFactory, ActivityMonitor activityMonitor); @NonNull static JobDispatcher shared(@NonNull Context context); void dispatch(@NonNull JobInfo jobInfo); void cancel(int jobId);  }
@Test public void testReschedule() throws SchedulerException { Bundle bundle = new Bundle(); bundle.putString("key", "value"); dispatcher.reschedule(jobInfo, bundle); verify(mockScheduler).reschedule(context, jobInfo, 3000002, bundle); }
@Test public void testRescheduleFallback() throws SchedulerException { doThrow(new SchedulerException("test")) .when(mockScheduler) .reschedule(context, jobInfo, 3000002, null); dispatcher.reschedule(jobInfo, null); verify(mockFallbackScheduler).reschedule(context, jobInfo, 3000002, null); }