private static void verifyOnUnbindCausesResult(JobService service, int expectedResult)
      throws Exception {
    Job jobSpec =
        TestUtil.getBuilderWithNoopValidator()
            .setTag("tag")
            .setService(service.getClass())
            .setTrigger(Trigger.NOW)
            .build();

    Bundle jobSpecData = getJobCoder().encode(jobSpec, new Bundle());
    FutureSettingJobCallback callback = new FutureSettingJobCallback();

    // start the service
    IRemoteJobService.Stub.asInterface(service.onBind(null)).start(jobSpecData, callback);
    // shouldn't have sent a result message yet (still doing background work)
    assertFalse(callback.getJobFinishedFuture().isDone());
    // manually trigger the onUnbind hook
    service.onUnbind(new Intent());

    flush(service);

    callback.verifyCalledWithJobAndResult(jobSpec, expectedResult);

    // Calling jobFinished should not attempt to send a second message
    callback.reset();
    service.jobFinished(jobSpec, false);
    assertFalse(callback.getJobFinishedFuture().isDone());
  }
Tests for the {@link JobService} class.
jobdispatcher/src/test/java/com/firebase/jobdispatcher/JobServiceTest.java