<commit_before>package com.kickstarter.ui.intents;

import android.content.Intent;
import android.net.Uri;

import com.kickstarter.KSRobolectricTestCase;
import com.kickstarter.services.DiscoveryParams;
import com.kickstarter.services.MockApiClient;
import com.kickstarter.ui.IntentKey;

import org.junit.Test;

import rx.observers.TestSubscriber;
import rx.subjects.PublishSubject;

public final class DiscoveryIntentActionTest extends KSRobolectricTestCase {
  @Test
  public void emitsStaffPicksFromEmptyIntent() {
    final TestSubscriber<DiscoveryParams> resultTest = TestSubscriber.create();
    final DiscoveryIntentAction intentAction = new DiscoveryIntentAction(resultTest::onNext, PublishSubject.create(), new MockApiClient());
    intentAction.intent(new Intent());

    resultTest.assertValues(DiscoveryParams.builder().staffPicks(true).build());
  }

  @Test
  public void emitsFromParamsExtra() {
    final DiscoveryParams params = DiscoveryParams.builder().build();
    final Intent intent = new Intent().putExtra(IntentKey.DISCOVERY_PARAMS, params);

    final TestSubscriber<DiscoveryParams> resultTest = TestSubscriber.create();
    final DiscoveryIntentAction intentAction = new DiscoveryIntentAction(resultTest::onNext, PublishSubject.create(), new MockApiClient());
    intentAction.intent(intent);

    resultTest.assertValues(params);
  }

  @Test
  public void emitsFromDiscoveryUri() {
    final Uri uri = Uri.parse("https://www.kickstarter.com/discover");
    final Intent intent = new Intent(Intent.ACTION_VIEW, uri);

    final TestSubscriber<DiscoveryParams> resultTest = TestSubscriber.create();
    final DiscoveryIntentAction intentAction = new DiscoveryIntentAction(resultTest::onNext, PublishSubject.create(), new MockApiClient());
    intentAction.intent(intent);

    resultTest.assertValues(DiscoveryParams.builder().build());
  }<commit_msg>Removed an old test.<commit_after>package com.kickstarter.ui.intents;

import android.content.Intent;
import android.net.Uri;

import com.kickstarter.KSRobolectricTestCase;
import com.kickstarter.services.DiscoveryParams;
import com.kickstarter.services.MockApiClient;
import com.kickstarter.ui.IntentKey;

import org.junit.Test;

import rx.observers.TestSubscriber;
import rx.subjects.PublishSubject;

public final class DiscoveryIntentActionTest extends KSRobolectricTestCase {
  @Test
  public void emitsFromParamsExtra() {
    final DiscoveryParams params = DiscoveryParams.builder().build();
    final Intent intent = new Intent().putExtra(IntentKey.DISCOVERY_PARAMS, params);

    final TestSubscriber<DiscoveryParams> resultTest = TestSubscriber.create();
    final DiscoveryIntentAction intentAction = new DiscoveryIntentAction(resultTest::onNext, PublishSubject.create(), new MockApiClient());
    intentAction.intent(intent);

    resultTest.assertValues(params);
  }

  @Test
  public void emitsFromDiscoveryUri() {
    final Uri uri = Uri.parse("https://www.kickstarter.com/discover");
    final Intent intent = new Intent(Intent.ACTION_VIEW, uri);

    final TestSubscriber<DiscoveryParams> resultTest = TestSubscriber.create();
    final DiscoveryIntentAction intentAction = new DiscoveryIntentAction(resultTest::onNext, PublishSubject.create(), new MockApiClient());
    intentAction.intent(intent);

    resultTest.assertValues(DiscoveryParams.builder().build());
  }
{'fraction_non_alphanumeric': 0.10023795359904819, 'fraction_numerical': 0.0, 'mean_word_length': 6.050314465408805, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3318378', 'n_tokens_mistral': 961, 'n_tokens_neox': 903, 'n_words': 186}