@Test @SmallTest public void testConvert_basicWorkSpec() { final String expectedWorkSpecId = "026e3422-9cd1-11e7-abc4-cec278b6b50a"; WorkSpec workSpec = new WorkSpec(expectedWorkSpecId, FirebaseTestWorker.class.getName()); Job job = mConverter.convert(workSpec); assertThat(job.getTag(), is(expectedWorkSpecId)); assertThat(job.getLifetime(), is(Lifetime.FOREVER)); assertThat(job.getService(), is(FirebaseJobService.class.getName())); JobTrigger.ImmediateTrigger trigger = (JobTrigger.ImmediateTrigger) job.getTrigger(); assertThat(trigger, is(Trigger.NOW)); }
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);   }