### Question:
FrameworkScheduler extends Scheduler { @SuppressLint("CommitPrefEdits") @VisibleForTesting int createId() { synchronized (FrameworkScheduler.class) { final SharedPreferences preferences = getPreferences(getApplicationContext()); final int id = preferences.getInt(KEY_ID, 0) + 1; preferences.edit().putInt(KEY_ID, id).commit(); return id; } } 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 createId() { when(mockSharedPreferences.getInt(FrameworkScheduler.KEY_ID, 0)).thenReturn(33); assertThat(fwScheduler.createId(), is(34)); verify(mockEditor).putInt(FrameworkScheduler.KEY_ID, 34); }