public Collection values() { if (values == null) values = singleton(this.value); return values; } }
public Set keySet() { if (keySet == null) keySet = singleton(this.key); return keySet; } public Set entrySet() {
public Set entrySet() { if (entrySet == null) entrySet = singleton(new SimpleImmutableEntry(this.key, this.value)); return entrySet; } public Collection values() {
@Test public void testJobRescheduledPassesUriAuthorityForward() { Uri changedUri = job.getTriggerContentUris()[0].getUri(); String changedAuthority = changedUri.getAuthority(); JobStatus failedJobStatus = new JobStatus(job, AlarmScheduler.TAG, 0, 0); failedJobStatus.changedUris = Collections.singleton(changedUri); failedJobStatus.changedAuthorities = Collections.singleton(changedAuthority); JobStatus newJobStatus = new JobStatus(job, AlarmScheduler.TAG, 0, 0); scheduler.onJobRescheduled(newJobStatus, failedJobStatus); assertThat(newJobStatus.changedUris, hasItem(changedUri)); assertThat(newJobStatus.changedAuthorities, hasItem(changedAuthority)); } }
@SuppressWarnings("unchecked") @Test public void testCompat() { Uri uri = Uri.parse("doist.com"); String authority = "com.doist"; JobInfo.Builder builder = JobCreator.create(context, 103) .addTriggerContentUri(new JobInfo.TriggerContentUri(uri, 0)) .setTriggerContentUpdateDelay(TimeUnit.SECONDS.toMillis(5)) .setTriggerContentMaxDelay(TimeUnit.SECONDS.toMillis(30)); Bundle transientExtras = new Bundle(); transientExtras.putBoolean("test", true); builder.setTransientExtras(transientExtras); JobInfo job = builder.build(); JobStatus jobStatus = JobStatus.createFromJobInfo(job, "noop"); jobStatus.changedUris = Collections.singleton(uri); jobStatus.changedAuthorities = Collections.singleton(authority); jobStore.add(jobStatus); waitForJobStoreWrite(); JobStore.JobSet jobStatusSet = new JobStore.JobSet(); jobStore.readJobMapFromDisk(jobStatusSet); assertEquals("Incorrect # of persisted tasks.", 1, jobStatusSet.size()); JobStatus loaded = jobStatusSet.getJobs().iterator().next(); assertEquals(jobStatus.changedUris, loaded.changedUris); assertEquals(jobStatus.changedAuthorities, loaded.changedAuthorities); assertJobInfoEquals(job, loaded.getJob()); }