@Test @SmallTest @SdkSuppress(minSdkVersion = 24) public void testConvert_requireContentUriTrigger() { final Uri expectedUri = Uri.parse("TEST_URI"); final ObservedUri expectedObservedUri = new ObservedUri(expectedUri, ObservedUri.Flags.FLAG_NOTIFY_FOR_DESCENDANTS); WorkSpec workSpec = new OneTimeWorkRequest.Builder(FirebaseTestWorker.class) .setConstraints(new Constraints.Builder() .addContentUriTrigger(expectedUri, true) .build()) .build() .getWorkSpec(); Job job = mConverter.convert(workSpec); JobTrigger.ContentUriTrigger trigger = (JobTrigger.ContentUriTrigger) job.getTrigger(); List<ObservedUri> observedUriList = trigger.getUris(); MatcherAssert.assertThat(observedUriList, contains(expectedObservedUri)); }
Job convert(WorkSpec workSpec) { Job.Builder builder = mDispatcher.newJobBuilder() .setService(FirebaseJobService.class) .setTag(workSpec.id) .setLifetime(Lifetime.FOREVER) .setReplaceCurrent(true) .setRetryStrategy(createRetryStrategy(workSpec)) .setConstraints(getConstraints(workSpec)); setExecutionTrigger(builder, workSpec); return builder.build(); }
FirebaseJobConverter { Job convert(WorkSpec workSpec) { Job.Builder builder = mDispatcher.newJobBuilder() .setService(FirebaseJobService.class) .setTag(workSpec.id) .setLifetime(Lifetime.FOREVER) .setReplaceCurrent(true) .setRetryStrategy(createRetryStrategy(workSpec)) .setConstraints(getConstraints(workSpec)); setExecutionTrigger(builder, workSpec); return builder.build(); } }
FirebaseJobConverter { Job convert(WorkSpec workSpec) { Job.Builder builder = mDispatcher.newJobBuilder() .setService(FirebaseJobService.class) .setTag(workSpec.id) .setLifetime(Lifetime.FOREVER) .setReplaceCurrent(true) .setRetryStrategy(createRetryStrategy(workSpec)) .setConstraints(getConstraints(workSpec)); setExecutionTrigger(builder, workSpec); return builder.build(); } FirebaseJobConverter(FirebaseJobDispatcher dispatcher); }
FirebaseJobConverter { Job convert(WorkSpec workSpec) { Job.Builder builder = mDispatcher.newJobBuilder() .setService(FirebaseJobService.class) .setTag(workSpec.id) .setLifetime(Lifetime.FOREVER) .setReplaceCurrent(true) .setRetryStrategy(createRetryStrategy(workSpec)) .setConstraints(getConstraints(workSpec)); setExecutionTrigger(builder, workSpec); return builder.build(); } FirebaseJobConverter(FirebaseJobDispatcher dispatcher);  }
FirebaseJobConverter { Job convert(WorkSpec workSpec) { Job.Builder builder = mDispatcher.newJobBuilder() .setService(FirebaseJobService.class) .setTag(workSpec.id) .setLifetime(Lifetime.FOREVER) .setReplaceCurrent(true) .setRetryStrategy(createRetryStrategy(workSpec)) .setConstraints(getConstraints(workSpec)); setExecutionTrigger(builder, workSpec); return builder.build(); } FirebaseJobConverter(FirebaseJobDispatcher dispatcher);   }