@Test
  public void onReschedule_stopJob() {
    Bundle bundle = TestUtil.getBundleForContentJobExecution();
    JobCoder prefixedCoder = new JobCoder(BundleProtocol.PACKED_PARAM_BUNDLE_PREFIX);
    JobInvocation invocation = prefixedCoder.decodeIntentBundle(bundle);

    Job job =
        TestUtil.getBuilderWithNoopValidator()
            .setService(TestJobService.class)
            .setTrigger(invocation.getTrigger())
            .setTag(invocation.getTag())
            .build();

    receiver.prepareJob(jobCallbackMock, bundle);
    when(contextMock.bindService(
            any(Intent.class), any(JobServiceConnection.class), eq(BIND_AUTO_CREATE)))
        .thenReturn(true);
    new ExecutionDelegator(contextMock, mock(JobFinishedCallback.class), contraintCheckerMock)
        .executeJob(invocation);
    verify(contextMock)
        .bindService(any(Intent.class), jobServiceConnectionCaptor.capture(), eq(BIND_AUTO_CREATE));

    assertTrue(jobServiceConnectionCaptor.getValue().hasJobInvocation(invocation));

    GooglePlayReceiver.onSchedule(job);
    assertFalse(jobServiceConnectionCaptor.getValue().hasJobInvocation(invocation));
    assertNull(
        "JobServiceConnection should be removed.",
        ExecutionDelegator.getJobServiceConnection(invocation.getService()));
  }
The default ShadowMessenger implementation causes NPEs when using the {@link
Messenger#Messenger(Handler)} constructor. We create our own empty Shadow so we can just use
the standard Android implementation, which is totally fine.

@see <a href="https://github.com/robolectric/robolectric/issues/2246">Robolectric issue</a>
jobdispatcher/src/test/java/com/firebase/jobdispatcher/GooglePlayReceiverTest.java