@Test
  public void testSchedule_failsWhenPlayServicesIsUnavailable() throws Exception {
    markBackendUnavailable();
    mockPackageManagerInfo();

    Job job = null;
    try {
      job =
          dispatcher
              .newJobBuilder()
              .setService(TestJobService.class)
              .setTag("foobar")
              .setConstraints(Constraint.DEVICE_CHARGING)
              .setTrigger(Trigger.executionWindow(0, 60))
              .build();
    } catch (ValidationEnforcer.ValidationException ve) {
      fail(TextUtils.join("\n", ve.getErrors()));
    }

    assertEquals(
        "Expected schedule() request to fail when backend is unavailable",
        FirebaseJobDispatcher.SCHEDULE_RESULT_NO_DRIVER_AVAILABLE,
        dispatcher.schedule(job));
  }
Tests for the {@link GooglePlayDriver} class.
jobdispatcher/src/test/java/com/firebase/jobdispatcher/GooglePlayDriverTest.java