### Question:
SchedulerConfig { @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public JobInfo.Builder configureJob( JobInfo.Builder builder, Priority priority, long minimumTimestamp, int attemptNumber) { long latency = getScheduleDelay(priority, minimumTimestamp, attemptNumber); builder.setMinimumLatency(latency); populateFlags(builder, getValues().get(priority).getFlags()); return builder; }  static SchedulerConfig getDefault(Clock clock); static SchedulerConfig.Builder builder(); long getScheduleDelay(Priority priority, long minTimestamp, int attemptNumber); @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) JobInfo.Builder configureJob(
      JobInfo.Builder builder, Priority priority, long minimumTimestamp, int attemptNumber); Set<Flag> getFlags(Priority priority);  }### Answer:
@Test public void configureJob_withDefaults_shouldSetCorrectFlags() { ComponentName serviceComponent = new ComponentName(RuntimeEnvironment.application, JobInfoSchedulerService.class); SchedulerConfig config = createConfig(Collections.emptySet(), DELTA); JobInfo job = config .configureJob(new JobInfo.Builder(1, serviceComponent), Priority.DEFAULT, 0, 1) .build(); assertThat(job.getNetworkType()).isEqualTo(JobInfo.NETWORK_TYPE_ANY); assertThat(job.isRequireDeviceIdle()).isFalse(); assertThat(job.isRequireCharging()).isFalse(); }
@Test public void configureJob_whenUnmetered_shouldSetCorrectFlags() { ComponentName serviceComponent = new ComponentName(RuntimeEnvironment.application, JobInfoSchedulerService.class); SchedulerConfig config = createConfig(EnumSet.of(SchedulerConfig.Flag.NETWORK_UNMETERED), DELTA); JobInfo job = config .configureJob(new JobInfo.Builder(1, serviceComponent), Priority.DEFAULT, 0, 1) .build(); assertThat(job.getNetworkType()).isEqualTo(JobInfo.NETWORK_TYPE_UNMETERED); assertThat(job.isRequireDeviceIdle()).isFalse(); assertThat(job.isRequireCharging()).isFalse(); }
@Test public void configureJob_whenIdle_shouldSetCorrectFlags() { ComponentName serviceComponent = new ComponentName(RuntimeEnvironment.application, JobInfoSchedulerService.class); SchedulerConfig config = createConfig(EnumSet.of(SchedulerConfig.Flag.DEVICE_IDLE), DELTA); JobInfo job = config .configureJob(new JobInfo.Builder(1, serviceComponent), Priority.DEFAULT, 0, 1) .build(); assertThat(job.getNetworkType()).isEqualTo(JobInfo.NETWORK_TYPE_ANY); assertThat(job.isRequireDeviceIdle()).isTrue(); assertThat(job.isRequireCharging()).isFalse(); }
@Test public void configureJob_whenCharging_shouldSetCorrectFlags() { ComponentName serviceComponent = new ComponentName(RuntimeEnvironment.application, JobInfoSchedulerService.class); SchedulerConfig config = createConfig(EnumSet.of(SchedulerConfig.Flag.DEVICE_CHARGING), DELTA); JobInfo job = config .configureJob(new JobInfo.Builder(1, serviceComponent), Priority.DEFAULT, 0, 1) .build(); assertThat(job.getNetworkType()).isEqualTo(JobInfo.NETWORK_TYPE_ANY); assertThat(job.isRequireDeviceIdle()).isFalse(); assertThat(job.isRequireCharging()).isTrue(); }