EventForwardingBroadcastReceiver extends BroadcastReceiver { public static IntentFilter getHtmlInterstitialIntentFilter() { if (sIntentFilter == null) { sIntentFilter = new IntentFilter(); sIntentFilter.addAction(ACTION_INTERSTITIAL_FAIL); sIntentFilter.addAction(ACTION_INTERSTITIAL_SHOW); sIntentFilter.addAction(ACTION_INTERSTITIAL_DISMISS); sIntentFilter.addAction(ACTION_INTERSTITIAL_CLICK); } return sIntentFilter; } EventForwardingBroadcastReceiver(CustomEventInterstitialListener customEventInterstitialListener, final long broadcastIdentifier); static IntentFilter getHtmlInterstitialIntentFilter(); @Override void onReceive(Context context, Intent intent); void register(Context context); void unregister(); static final String ACTION_INTERSTITIAL_FAIL; static final String ACTION_INTERSTITIAL_SHOW; static final String ACTION_INTERSTITIAL_DISMISS; static final String ACTION_INTERSTITIAL_CLICK; }
@Test public void constructor_shouldSetIntentFilter() throws Exception { Set<String> expectedActions = Sets.newLinkedHashSet( ACTION_INTERSTITIAL_FAIL, ACTION_INTERSTITIAL_SHOW, ACTION_INTERSTITIAL_DISMISS, ACTION_INTERSTITIAL_CLICK ); final IntentFilter intentFilter = EventForwardingBroadcastReceiver.getHtmlInterstitialIntentFilter(); final Iterator<String> actionIterator = intentFilter.actionsIterator(); assertThat(intentFilter.countActions()).isEqualTo(4); while (actionIterator.hasNext()) { assertThat(expectedActions.contains(actionIterator.next())); } }