<commit_before>package com.auth0.android.lock.utils;

import com.auth0.android.lock.BuildConfig;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.annotation.Config;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import static com.auth0.android.lock.utils.Strategies.ADFS;
import static com.auth0.android.lock.utils.Strategies.Auth0;
import static com.auth0.android.lock.utils.Strategies.Email;
import static com.auth0.android.lock.utils.Strategies.Facebook;
import static com.auth0.android.lock.utils.Strategies.Office365;
import static com.auth0.android.lock.utils.Strategies.SAMLP;
import static com.auth0.android.lock.utils.Strategies.SMS;
import static com.auth0.android.lock.utils.Strategies.Twitter;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;

@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21, manifest = Config.NONE)
public class ApplicationTest {

    public static final String ID = "ID";
    public static final String TENANT = "TENANT";
    public static final String AUTHORIZE_URL = "AUTHORIZE";
    public static final String CALLBACK_URL = "CALLBACK";
    public static final String SUBSCRIPTION = "SUBSCRIPTION";
    public static final boolean HAS_ALLOWED_ORIGINS = true;

    @Test
    public void shouldInstantiateApplication() throws Exception {
        Application application = newApplicationWithStrategies(Auth0);
        assertThat(application, is(notNullValue()));
    }

    @Test
    public void shouldHaveApplicationInfo() throws Exception {
        Application application = newApplicationWithStrategies(Auth0);
        assertThat(application.getId(), equalTo(ID));
        assertThat(application.getTenant(), equalTo(TENANT));
        assertThat(application.getAuthorizeURL(), equalTo(AUTHORIZE_URL));
        assertThat(application.getCallbackURL(), equalTo(CALLBACK_URL));
        assertThat(application.getSubscription(), equalTo(SUBSCRIPTION));
        assertThat(application.isHasAllowedOrigins(), equalTo(HAS_ALLOWED_ORIGINS));
    }

    @Test
    public void shouldReturnDatabaseStrategy() throws Exception {
        Application application = newApplicationWithStrategies(Auth0);
        assertThat(application.getDatabaseStrategy(), is(notNullValue()));
        assertThat(application.getDatabaseStrategy().getName(), equalTo(Auth0.getName()));
    }

    @Test
    public void shouldReturnNoDatabaseStrategy() throws Exception {
        Application application = newApplicationWithStrategies(Facebook);
        assertThat(application.getDatabaseStrategy(), is(nullValue()));
    }

    @Test
    public void shouldReturnSocialStrategies() throws Exception {
        Application application = newApplicationWithStrategies(Facebook, Twitter, Auth0);
        assertThat(application.getSocialStrategies().size(), equalTo(2));
    }

    @Test
    public void shouldReturnEnterpriseStrategies() throws Exception {
        Application application = newApplicationWithStrategies(Auth0, ADFS, SAMLP, Office365);
        assertThat(application.getEnterpriseStrategies().size(), equalTo(3));
    }

    @Test
    public void shouldReturnPasswordlessStrategies() throws Exception {
        Application application = newApplicationWithStrategies(Email, SMS, Facebook, Auth0);
        assertThat(application.getPasswordlessStrategies().size(), equalTo(2));
    }

    private static Strategy newStrategyFor(Strategies strategyMetadata) {
        return new Strategy(strategyMetadata.getName(), Arrays.asList(mock(Connection.class)));
    }

    private static Application newApplicationWithStrategies(Strategies... list) {
        List<Strategy> strategies = new ArrayList<>();
        for (Strategies str : list) {
            strategies.add(newStrategyFor(str));
        }
        Application application = new Application(ID, TENANT, AUTHORIZE_URL, CALLBACK_URL, SUBSCRIPTION, HAS_ALLOWED_ORIGINS, strategies);
        return application;
    }
}<commit_msg>fix test case for passwordless strategies filter<commit_after>package com.auth0.android.lock.utils;

import com.auth0.android.lock.BuildConfig;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.annotation.Config;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import static com.auth0.android.lock.utils.Strategies.ADFS;
import static com.auth0.android.lock.utils.Strategies.Auth0;
import static com.auth0.android.lock.utils.Strategies.Email;
import static com.auth0.android.lock.utils.Strategies.Facebook;
import static com.auth0.android.lock.utils.Strategies.Office365;
import static com.auth0.android.lock.utils.Strategies.SAMLP;
import static com.auth0.android.lock.utils.Strategies.SMS;
import static com.auth0.android.lock.utils.Strategies.Twitter;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;

@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21, manifest = Config.NONE)
public class ApplicationTest {

    public static final String ID = "ID";
    public static final String TENANT = "TENANT";
    public static final String AUTHORIZE_URL = "AUTHORIZE";
    public static final String CALLBACK_URL = "CALLBACK";
    public static final String SUBSCRIPTION = "SUBSCRIPTION";
    public static final boolean HAS_ALLOWED_ORIGINS = true;

    @Test
    public void shouldInstantiateApplication() throws Exception {
        Application application = newApplicationWithStrategies(Auth0);
        assertThat(application, is(notNullValue()));
    }

    @Test
    public void shouldHaveApplicationInfo() throws Exception {
        Application application = newApplicationWithStrategies(Auth0);
        assertThat(application.getId(), equalTo(ID));
        assertThat(application.getTenant(), equalTo(TENANT));
        assertThat(application.getAuthorizeURL(), equalTo(AUTHORIZE_URL));
        assertThat(application.getCallbackURL(), equalTo(CALLBACK_URL));
        assertThat(application.getSubscription(), equalTo(SUBSCRIPTION));
        assertThat(application.isHasAllowedOrigins(), equalTo(HAS_ALLOWED_ORIGINS));
    }

    @Test
    public void shouldReturnDatabaseStrategy() throws Exception {
        Application application = newApplicationWithStrategies(Auth0);
        assertThat(application.getDatabaseStrategy(), is(notNullValue()));
        assertThat(application.getDatabaseStrategy().getName(), equalTo(Auth0.getName()));
    }

    @Test
    public void shouldReturnNoDatabaseStrategy() throws Exception {
        Application application = newApplicationWithStrategies(Facebook);
        assertThat(application.getDatabaseStrategy(), is(nullValue()));
    }

    @Test
    public void shouldReturnSocialStrategies() throws Exception {
        Application application = newApplicationWithStrategies(Facebook, Twitter, Auth0);
        assertThat(application.getSocialStrategies().size(), equalTo(2));
    }

    @Test
    public void shouldReturnEnterpriseStrategies() throws Exception {
        Application application = newApplicationWithStrategies(Auth0, ADFS, SAMLP, Office365);
        assertThat(application.getEnterpriseStrategies().size(), equalTo(3));
    }

    @Test
    public void shouldReturnPasswordlessStrategies() throws Exception {
        Application application = newApplicationWithStrategies(Email, SMS, Facebook, Auth0, SAMLP);
        assertThat(application.getPasswordlessStrategies().size(), equalTo(2));
    }

    private static Strategy newStrategyFor(Strategies strategyMetadata) {
        return new Strategy(strategyMetadata.getName(), Arrays.asList(mock(Connection.class)));
    }

    private static Application newApplicationWithStrategies(Strategies... list) {
        List<Strategy> strategies = new ArrayList<>();
        for (Strategies str : list) {
            strategies.add(newStrategyFor(str));
        }
        Application application = new Application(ID, TENANT, AUTHORIZE_URL, CALLBACK_URL, SUBSCRIPTION, HAS_ALLOWED_ORIGINS, strategies);
        return application;
    }
}
{'fraction_non_alphanumeric': 0.0966876603685561, 'fraction_numerical': 0.0067646372754840214, 'mean_word_length': 4.656332453825858, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3835741', 'n_tokens_mistral': 2388, 'n_tokens_neox': 2331, 'n_words': 483}