<commit_before>package it.restart.com.atlassian.jira.plugins.dvcs.test.pullRequest;

import com.atlassian.jira.mock.component.MockComponentWorker;
import com.atlassian.jira.pageobjects.JiraTestedProduct;
import com.atlassian.jira.plugins.dvcs.pageobjects.common.MagicVisitor;
import com.atlassian.jira.plugins.dvcs.pageobjects.page.BitbucketOAuthPage;
import com.atlassian.jira.plugins.dvcs.pageobjects.page.account.AccountsPageAccount;
import com.atlassian.jira.plugins.dvcs.spi.bitbucket.clientlibrary.model.BitbucketPullRequest;
import it.restart.com.atlassian.jira.plugins.dvcs.testClient.BitbucketPRClient;
import it.restart.com.atlassian.jira.plugins.dvcs.testClient.BitbucketRepositoryTestHelper;
import it.restart.com.atlassian.jira.plugins.dvcs.testClient.RepositoryTestHelper;
import it.util.TestAccounts;
import org.mockito.MockitoAnnotations;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;

import static it.restart.com.atlassian.jira.plugins.dvcs.test.IntegrationTestUserDetails.ACCOUNT_NAME;
import static it.restart.com.atlassian.jira.plugins.dvcs.test.IntegrationTestUserDetails.PASSWORD;

public class BitbucketPRTest extends PullRequestTestCases<BitbucketPullRequest>
{
    private static final String BB_ACCOUNT_NAME = TestAccounts.JIRA_BB_CONNECTOR_ACCOUNT;

    private RepositoryTestHelper repositoryTestHelper;
    private RepositoryTestHelper forkRepositoryTestHelper;

    public BitbucketPRTest()
    {
    }

    @BeforeClass
    public void beforeClass()
    {
        onTestsEnvironmentSetup();
    }

    @AfterMethod
    public void afterMethod()
    {
        onTestCleanUp();
    }

    @Override
    protected void beforeEachTestClassInitialisation(final JiraTestedProduct jiraTestedProduct)
    {
        repositoryTestHelper = new BitbucketRepositoryTestHelper(ACCOUNT_NAME, PASSWORD, getJiraTestedProduct(),
                BitbucketRepositoryTestHelper.DvcsType.MERCURIAL);
        repositoryTestHelper.initialiseOrganizationsAndDvcs(null, null);

        this.dvcs = repositoryTestHelper.getDvcs();
        this.oAuth = repositoryTestHelper.getoAuth();

        forkRepositoryTestHelper = new BitbucketRepositoryTestHelper(FORK_ACCOUNT_NAME, FORK_ACCOUNT_PASSWORD,
                getJiraTestedProduct(), BitbucketRepositoryTestHelper.DvcsType.MERCURIAL);
        forkRepositoryTestHelper.initialiseOrganizationsAndDvcs(dvcs, oAuth);

        MockitoAnnotations.initMocks(this);
        final MockComponentWorker mockComponentWorker = new MockComponentWorker().init();
        mockComponentWorker.getMockApplicationProperties().setEncoding("US-ASCII");
        pullRequestClient = new BitbucketPRClient();
    }

    @Override<commit_msg>FUSE-2534 Use GIT repository to run test instead of Mercurial. When using Mercurial we depend on a 3rd party library (javahg) that is not compatible with Guava 18.0. Problem is it looks like this project has been abandoned. Last release is 3 weeks ago.<commit_after>package it.restart.com.atlassian.jira.plugins.dvcs.test.pullRequest;

import com.atlassian.jira.mock.component.MockComponentWorker;
import com.atlassian.jira.pageobjects.JiraTestedProduct;
import com.atlassian.jira.plugins.dvcs.pageobjects.common.MagicVisitor;
import com.atlassian.jira.plugins.dvcs.pageobjects.page.BitbucketOAuthPage;
import com.atlassian.jira.plugins.dvcs.pageobjects.page.account.AccountsPageAccount;
import com.atlassian.jira.plugins.dvcs.spi.bitbucket.clientlibrary.model.BitbucketPullRequest;
import it.restart.com.atlassian.jira.plugins.dvcs.testClient.BitbucketPRClient;
import it.restart.com.atlassian.jira.plugins.dvcs.testClient.BitbucketRepositoryTestHelper;
import it.restart.com.atlassian.jira.plugins.dvcs.testClient.RepositoryTestHelper;
import it.util.TestAccounts;
import org.mockito.MockitoAnnotations;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;

import static it.restart.com.atlassian.jira.plugins.dvcs.test.IntegrationTestUserDetails.ACCOUNT_NAME;
import static it.restart.com.atlassian.jira.plugins.dvcs.test.IntegrationTestUserDetails.PASSWORD;

public class BitbucketPRTest extends PullRequestTestCases<BitbucketPullRequest>
{
    private static final String BB_ACCOUNT_NAME = TestAccounts.JIRA_BB_CONNECTOR_ACCOUNT;

    private RepositoryTestHelper repositoryTestHelper;
    private RepositoryTestHelper forkRepositoryTestHelper;

    public BitbucketPRTest()
    {
    }

    @BeforeClass
    public void beforeClass()
    {
        onTestsEnvironmentSetup();
    }

    @AfterMethod
    public void afterMethod()
    {
        onTestCleanUp();
    }

    @Override
    protected void beforeEachTestClassInitialisation(final JiraTestedProduct jiraTestedProduct)
    {
        repositoryTestHelper = new BitbucketRepositoryTestHelper(ACCOUNT_NAME, PASSWORD, getJiraTestedProduct(),
                BitbucketRepositoryTestHelper.DvcsType.GIT);
        repositoryTestHelper.initialiseOrganizationsAndDvcs(null, null);

        this.dvcs = repositoryTestHelper.getDvcs();
        this.oAuth = repositoryTestHelper.getoAuth();

        forkRepositoryTestHelper = new BitbucketRepositoryTestHelper(FORK_ACCOUNT_NAME, FORK_ACCOUNT_PASSWORD,
                getJiraTestedProduct(), BitbucketRepositoryTestHelper.DvcsType.GIT);
        forkRepositoryTestHelper.initialiseOrganizationsAndDvcs(dvcs, oAuth);

        MockitoAnnotations.initMocks(this);
        final MockComponentWorker mockComponentWorker = new MockComponentWorker().init();
        mockComponentWorker.getMockApplicationProperties().setEncoding("US-ASCII");
        pullRequestClient = new BitbucketPRClient();
    }

    @Override
{'fraction_non_alphanumeric': 0.07987276904046652, 'fraction_numerical': 0.001590386994168581, 'mean_word_length': 4.995762711864407, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1122794', 'n_tokens_mistral': 1686, 'n_tokens_neox': 1649, 'n_words': 242}