AlarmScheduler implements Scheduler { @Override public void schedule(@NonNull Context context, @NonNull JobInfo jobInfo, int id) throws SchedulerException { long delay = jobInfo.getInitialDelay(); if (delay <= 0) { delay = DEFAULT_STARTING_BACK_OFF_TIME_MS; } scheduleIntent(context, jobInfo, id, delay); }  @Override void cancel(@NonNull Context context, int scheduleId); @Override void schedule(@NonNull Context context, @NonNull JobInfo jobInfo, int id); @Override void reschedule(@NonNull Context context, @NonNull JobInfo jobInfo, int scheduleId, @Nullable Bundle extras);  }
@Test public void testSchedule() throws SchedulerException { JobInfo jobInfo = JobInfo.newBuilder() .setAction("Some action") .setInitialDelay(1, TimeUnit.MILLISECONDS) .build(); scheduler.schedule(context, jobInfo, 20); verifyScheduledJob(jobInfo, 20, 1); }