<commit_before>package de.fau.amos.virtualledger.server.banking.adorsys.api;

import de.fau.amos.virtualledger.server.banking.adorsys.api.bankAccessEndpoint.BankAccessEndpoint;
import de.fau.amos.virtualledger.server.banking.adorsys.api.bankAccessEndpoint.DummyBankAccessEndpoint;
import de.fau.amos.virtualledger.server.banking.adorsys.api.bankAccessEndpoint.HttpBankAccessEndpoint;
import de.fau.amos.virtualledger.server.banking.adorsys.api.bankAccountEndpoint.BankAccountEndpoint;
import de.fau.amos.virtualledger.server.banking.adorsys.api.bankAccountEndpoint.DummyBankAccountEndpoint;
import de.fau.amos.virtualledger.server.banking.adorsys.api.bankAccountEndpoint.HttpBankAccountEndpoint;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class BankingApiBinderTest {

    @Mock
    private BankingApiConfiguration bankingApiConfiguration;

    @Before
    public void setUp() {
        when(bankingApiConfiguration.getTestUserName()).thenReturn("<EMAIL>");
    }


    @Test
    public void getBankAccountEndpointDummy() {
        // SETUP
        String username = "<EMAIL>";
        BankingApiBinder bankingApiBinder = new BankingApiBinder(this.bankingApiConfiguration, null, null,
                new HttpBankAccountEndpoint(), new DummyBankAccountEndpoint(null));

        // EXECUTE
        BankAccountEndpoint endpoint = bankingApiBinder.getBankAccountEndpoint(username);

        // ASSERT
        Assert.assertNotNull(endpoint);
        Assert.assertTrue(endpoint instanceof DummyBankAccountEndpoint);
        verify(bankingApiConfiguration, times(1)).getTestUserName();
    }

    @Test
    public void getBankAccountEndpointHttp() {
        // SETUP
        String username = <EMAIL>";
        BankingApiBinder bankingApiBinder = new BankingApiBinder(this.bankingApiConfiguration, null, null,
                new HttpBankAccountEndpoint(), new DummyBankAccountEndpoint(null));

        // EXECUTE
        BankAccountEndpoint endpoint = bankingApiBinder.getBankAccountEndpoint(username);

        // ASSERT
        Assert.assertNotNull(endpoint);
        Assert.assertTrue(endpoint instanceof HttpBankAccountEndpoint);
        verify(bankingApiConfiguration, times(1)).getTestUserName();
    }

    @Test
    public void getBankAccessEndpointDummy() {
        // SETUP
        String username = "<EMAIL>";
        BankingApiBinder bankingApiBinder = new BankingApiBinder(this.bankingApiConfiguration, new HttpBankAccessEndpoint(), new DummyBankAccessEndpoint(), null, null);

        // EXECUTE
        BankAccessEndpoint endpoint = bankingApiBinder.getBankAccessEndpoint(username);

        // ASSERT
        Assert.assertNotNull(endpoint);
        Assert.assertTrue(endpoint instanceof DummyBankAccessEndpoint);
        verify(bankingApiConfiguration, times(1)).getTestUserName();
    }

    @Test
    public void getBankAccessEndpointHttp() {
        // SETUP
        String username = <EMAIL>";
        BankingApiBinder bankingApiBinder = new BankingApiBinder(this.bankingApiConfiguration,
                new HttpBankAccessEndpoint(), new DummyBankAccessEndpoint(), null, null);

        // EXECUTE
        BankAccessEndpoint endpoint = bankingApiBinder.getBankAccessEndpoint(username);

        // ASSERT
        Assert.assertNotNull(endpoint);
        Assert.assertTrue(endpoint instanceof HttpBankAccessEndpoint);
        verify(bankingApiConfiguration, times(1)).getTestUserName();
    }
}<commit_msg>Fixed test<commit_after>package de.fau.amos.virtualledger.server.banking.adorsys.api;

import de.fau.amos.virtualledger.server.banking.adorsys.api.bankAccessEndpoint.BankAccessEndpoint;
import de.fau.amos.virtualledger.server.banking.adorsys.api.bankAccessEndpoint.DummyBankAccessEndpoint;
import de.fau.amos.virtualledger.server.banking.adorsys.api.bankAccessEndpoint.HttpBankAccessEndpoint;
import de.fau.amos.virtualledger.server.banking.adorsys.api.bankAccountEndpoint.BankAccountEndpoint;
import de.fau.amos.virtualledger.server.banking.adorsys.api.bankAccountEndpoint.DummyBankAccountEndpoint;
import de.fau.amos.virtualledger.server.banking.adorsys.api.bankAccountEndpoint.HttpBankAccountEndpoint;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class BankingApiBinderTest {

    @Mock
    private BankingApiConfiguration bankingApiConfiguration;

    @Before
    public void setUp() {
        when(bankingApiConfiguration.getTestUserName()).thenReturn("<EMAIL>");
    }


    @Test
    public void getBankAccountEndpointDummy() {
        // SETUP
        String username = "<EMAIL>";
        BankingApiBinder bankingApiBinder = new BankingApiBinder(this.bankingApiConfiguration, null, null,
                new HttpBankAccountEndpoint(), new DummyBankAccountEndpoint(null));

        // EXECUTE
        BankAccountEndpoint endpoint = bankingApiBinder.getBankAccountEndpoint(username);

        // ASSERT
        Assert.assertNotNull(endpoint);
        Assert.assertTrue(endpoint instanceof DummyBankAccountEndpoint);
        verify(bankingApiConfiguration, times(1)).getTestUserName();
    }

    @Test
    public void getBankAccountEndpointHttp() {
        // SETUP
        String username = "!<EMAIL>";
        BankingApiBinder bankingApiBinder = new BankingApiBinder(this.bankingApiConfiguration, null, null,
                new HttpBankAccountEndpoint(), new DummyBankAccountEndpoint(null));

        // EXECUTE
        BankAccountEndpoint endpoint = bankingApiBinder.getBankAccountEndpoint(username);

        // ASSERT
        Assert.assertNotNull(endpoint);
        Assert.assertTrue(endpoint instanceof HttpBankAccountEndpoint);
        verify(bankingApiConfiguration, times(1)).getTestUserName();
    }

    @Test
    public void getBankAccessEndpointDummy() {
        // SETUP
        String username = "<EMAIL>";
        BankingApiBinder bankingApiBinder = new BankingApiBinder(this.bankingApiConfiguration, new HttpBankAccessEndpoint(null), new DummyBankAccessEndpoint(), null, null);

        // EXECUTE
        BankAccessEndpoint endpoint = bankingApiBinder.getBankAccessEndpoint(username);

        // ASSERT
        Assert.assertNotNull(endpoint);
        Assert.assertTrue(endpoint instanceof DummyBankAccessEndpoint);
        verify(bankingApiConfiguration, times(1)).getTestUserName();
    }

    @Test
    public void getBankAccessEndpointHttp() {
        // SETUP
        String username = "!<EMAIL>";
        BankingApiBinder bankingApiBinder = new BankingApiBinder(this.bankingApiConfiguration,
                new HttpBankAccessEndpoint(null), new DummyBankAccessEndpoint(), null, null);

        // EXECUTE
        BankAccessEndpoint endpoint = bankingApiBinder.getBankAccessEndpoint(username);

        // ASSERT
        Assert.assertNotNull(endpoint);
        Assert.assertTrue(endpoint instanceof HttpBankAccessEndpoint);
        verify(bankingApiConfiguration, times(1)).getTestUserName();
    }
}
{'fraction_non_alphanumeric': 0.09043338253052462, 'fraction_numerical': 0.0010733932644572655, 'mean_word_length': 3.897503285151117, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '685296', 'n_tokens_mistral': 2054, 'n_tokens_neox': 2010, 'n_words': 329}