### Question:
FrameworkScheduler extends Scheduler { @VisibleForTesting static SchedulerConstraint fromBundle(PersistableBundle bundle) throws Exception { SchedulerConstraint constraint = new SchedulerConstraint(bundle.getString(KEY_UUID)); if (constraint.getUuid() == null) { constraint.setUuid(UUID.randomUUID().toString()); } constraint.setNetworkStatus(bundle.getInt(KEY_NETWORK_STATUS, NetworkUtil.DISCONNECTED)); constraint.setDelayInMs(bundle.getLong(KEY_DELAY, 0)); if (bundle.containsKey(KEY_DEADLINE)) { constraint.setOverrideDeadlineInMs(bundle.getLong(KEY_DEADLINE, Params.FOREVER)); } return constraint; } FrameworkScheduler(Class<? extends FrameworkJobSchedulerService> serviceImpl); @SuppressLint("SwitchIntDef") @Override void request(SchedulerConstraint constraint); @Override void onFinished(SchedulerConstraint constraint, boolean reschedule); @Override void cancelAll();  }### Answer:
@Test public void bundle() throws Exception { SchedulerConstraint constraint = mock(SchedulerConstraint.class); when(constraint.getNetworkStatus()).thenReturn(NetworkUtil.METERED); when(constraint.getUuid()).thenReturn("abc"); when(constraint.getDelayInMs()).thenReturn(345L); when(constraint.getOverrideDeadlineInMs()).thenReturn(235L); JobInfo jobInfo = schedule(constraint); PersistableBundle extras = jobInfo.getExtras(); SchedulerConstraint fromBundle = FrameworkScheduler.fromBundle(extras); assertThat(fromBundle.getNetworkStatus(), is(NetworkUtil.METERED)); assertThat(fromBundle.getUuid(), is("abc")); assertThat(fromBundle.getDelayInMs(), is(345L)); assertThat(fromBundle.getOverrideDeadlineInMs(), is(235L)); }
@Test public void bundleNullDeadline() throws Exception { SchedulerConstraint constraint = mock(SchedulerConstraint.class); when(constraint.getNetworkStatus()).thenReturn(NetworkUtil.METERED); when(constraint.getUuid()).thenReturn("abc"); when(constraint.getDelayInMs()).thenReturn(345L); when(constraint.getOverrideDeadlineInMs()).thenReturn(null); JobInfo jobInfo = schedule(constraint); PersistableBundle extras = jobInfo.getExtras(); SchedulerConstraint fromBundle = FrameworkScheduler.fromBundle(extras); assertThat(fromBundle.getNetworkStatus(), is(NetworkUtil.METERED)); assertThat(fromBundle.getUuid(), is("abc")); assertThat(fromBundle.getDelayInMs(), is(345L)); assertThat(fromBundle.getOverrideDeadlineInMs(), is(nullValue())); }