@Test
  public void testOnStartCommand_handlesStartJob_validRequest() throws Exception {
    JobService service = spy(new ExampleJobService());

    Job jobSpec =
        TestUtil.getBuilderWithNoopValidator()
            .setTag("tag")
            .setService(ExampleJobService.class)
            .setRetryStrategy(RetryStrategy.DEFAULT_EXPONENTIAL)
            .setTrigger(Trigger.NOW)
            .setLifetime(Lifetime.FOREVER)
            .build();

    countDownLatch = new CountDownLatch(1);

    Bundle jobSpecData = getJobCoder().encode(jobSpec, new Bundle());
    IRemoteJobService remoteJobService =
        IRemoteJobService.Stub.asInterface(service.onBind(new Intent(JobService.ACTION_EXECUTE)));
    remoteJobService.start(jobSpecData, noopCallback);

    flush(service);

    assertTrue("Expected job to run to completion", countDownLatch.await(5, TimeUnit.SECONDS));
  }
Tests for the {@link JobService} class.
jobdispatcher/src/test/java/com/firebase/jobdispatcher/JobServiceTest.java