@Test
  public void dump_oneRunningJob() throws Exception {
    countDownLatch = new CountDownLatch(1);
    JobService service =
        new JobService() {
          @Override
          public boolean onStartJob(JobParameters job) {
            countDownLatch.countDown();
            return true; // more work to do
          }

          @Override
          public boolean onStopJob(JobParameters job) {
            return false;
          }
        };

    Job jobSpec =
        TestUtil.getBuilderWithNoopValidator()
            .setTag("one_running_job")
            .setService(service.getClass())
            .setTrigger(Trigger.NOW)
            .build();

    Bundle jobSpecData = getJobCoder().encode(jobSpec, new Bundle());
    FutureSettingJobCallback callback = new FutureSettingJobCallback();
    IRemoteJobService stub = IRemoteJobService.Stub.asInterface(service.onBind(null));

    ShadowSystemClock.setCurrentTimeMillis(10_000L);
    // Start the job
    stub.start(jobSpecData, callback);
    flush(service);

    // Make sure it was started
    assertThat(countDownLatch.await(1, TimeUnit.SECONDS)).isTrue();
    // Fast forward 30s
    ShadowSystemClock.setCurrentTimeMillis(40_000L);

    assertThat(dump(service))
        .isEqualTo("Running jobs:\n    * \"one_running_job\" has been running for 00:30\n");

    stub.stop(jobSpecData, /* needToSendResult= */ false);
    flush(service);

    assertThat(dump(service)).isEqualTo("No running jobs\n");
  }
Tests for the {@link JobService} class.
jobdispatcher/src/test/java/com/firebase/jobdispatcher/JobServiceTest.java