@Test public void onReceiveResumeApp() { Context mockContext = mock(Context.class); Intent mockIntent = mock(Intent.class); when(mockIntent.getAction()).thenReturn(DownloadManager.ACTION_NOTIFICATION_CLICKED); DownloadManagerReceiver downloadManagerReceiver = new DownloadManagerReceiver(); downloadManagerReceiver.onReceive(mockContext, mockIntent); verify(mDistribute).resumeApp(mockContext); }
@Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (DownloadManager.ACTION_NOTIFICATION_CLICKED.equals(action)) { Distribute.getInstance().resumeApp(context); } else if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) { long downloadId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, INVALID_DOWNLOAD_IDENTIFIER); if (downloadId != INVALID_DOWNLOAD_IDENTIFIER) { AsyncTaskUtils.execute(LOG_TAG, new ResumeFromBackgroundTask(context, downloadId)); } } }
DownloadManagerReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (DownloadManager.ACTION_NOTIFICATION_CLICKED.equals(action)) { Distribute.getInstance().resumeApp(context); } else if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) { long downloadId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, INVALID_DOWNLOAD_IDENTIFIER); if (downloadId != INVALID_DOWNLOAD_IDENTIFIER) { AsyncTaskUtils.execute(LOG_TAG, new ResumeFromBackgroundTask(context, downloadId)); } } } }
DownloadManagerReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (DownloadManager.ACTION_NOTIFICATION_CLICKED.equals(action)) { Distribute.getInstance().resumeApp(context); } else if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) { long downloadId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, INVALID_DOWNLOAD_IDENTIFIER); if (downloadId != INVALID_DOWNLOAD_IDENTIFIER) { AsyncTaskUtils.execute(LOG_TAG, new ResumeFromBackgroundTask(context, downloadId)); } } }  }
DownloadManagerReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (DownloadManager.ACTION_NOTIFICATION_CLICKED.equals(action)) { Distribute.getInstance().resumeApp(context); } else if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) { long downloadId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, INVALID_DOWNLOAD_IDENTIFIER); if (downloadId != INVALID_DOWNLOAD_IDENTIFIER) { AsyncTaskUtils.execute(LOG_TAG, new ResumeFromBackgroundTask(context, downloadId)); } } }  @Override void onReceive(Context context, Intent intent); }
DownloadManagerReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (DownloadManager.ACTION_NOTIFICATION_CLICKED.equals(action)) { Distribute.getInstance().resumeApp(context); } else if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) { long downloadId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, INVALID_DOWNLOAD_IDENTIFIER); if (downloadId != INVALID_DOWNLOAD_IDENTIFIER) { AsyncTaskUtils.execute(LOG_TAG, new ResumeFromBackgroundTask(context, downloadId)); } } }  @Override void onReceive(Context context, Intent intent);  }