@Test public void getStartActivityIntent_withApplicationContext_shouldReturnIntentWithNewTaskFlag() throws Exception { Context context = new Activity().getApplicationContext(); final Intent intent = Intents.getStartActivityIntent(context, MoPubBrowser.class, null); assertThat(intent.getComponent().getClassName()).isEqualTo(MoPubBrowser.class.getName()); assertThat(Utils.bitMaskContainsFlag(intent.getFlags(), FLAG_ACTIVITY_NEW_TASK)).isTrue(); assertThat(intent.getExtras()).isNull(); }
@Test public void getStartActivityIntent_withBundle_shouldReturnIntentWithExtras() throws Exception { Context context = new Activity(); Bundle bundle = new Bundle(); bundle.putString("arbitrary key", "even more arbitrary value"); final Intent intent = Intents.getStartActivityIntent(context, MoPubBrowser.class, bundle); assertThat(intent.getComponent().getClassName()).isEqualTo(MoPubBrowser.class.getName()); assertThat(Utils.bitMaskContainsFlag(intent.getFlags(), FLAG_ACTIVITY_NEW_TASK)).isFalse(); assertThat(intent.getExtras()).isEqualTo(bundle); }