GooglePlayDriver implements Driver { @Override public int cancel(@NonNull String tag) { context.sendBroadcast(createCancelRequest(tag)); return FirebaseJobDispatcher.CANCEL_RESULT_SUCCESS; } GooglePlayDriver(@NonNull Context context); @Override boolean isAvailable(); @Override @ScheduleResult int schedule(@NonNull Job job); @Override int cancel(@NonNull String tag); @Override int cancelAll(); @NonNull @Override JobValidator getValidator();  }
@Test public void testCancel_sendsAppropriateBroadcast() { dispatcher.cancel("foobar"); ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class); verify(mMockContext).sendBroadcast(captor.capture()); Intent broadcast = captor.getValue(); assertNotNull(broadcast); assertEquals("foobar", broadcast.getStringExtra("tag")); }