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

import de.fau.amos.virtualledger.server.banking.adorsys.api.bankAccessEndpoint.DummyBankAccessEndpoint;
import de.fau.amos.virtualledger.server.banking.model.BankAccessBankingModel;
import de.fau.amos.virtualledger.server.banking.model.BankAccountBankingModel;
import org.junit.Test;

import java.util.List;

import static org.junit.Assert.*;

/**
 * Created by Georg on 27.06.2017.
 */
public class DummyBankAccountEndpointTest {
    @Test
    public void getBankAccounts_accountExists() throws Exception {
        // SETUP
        String testUserId = "userId";
        DummyBankAccessEndpoint dummyBankAccessEndpoint = new DummyBankAccessEndpoint();
        dummyBankAccessEndpoint.addBankAccess(testUserId, new BankAccessBankingModel());
        BankAccessBankingModel bankAccessBankingModel = dummyBankAccessEndpoint.getBankAccesses(testUserId).get(0);

        DummyBankAccountEndpoint dummyBankAccountEndpoint = new DummyBankAccountEndpoint(dummyBankAccessEndpoint);

        // ACT
        List<BankAccountBankingModel> bankAccounts = dummyBankAccountEndpoint.getBankAccounts(testUserId, bankAccessBankingModel.getId());

        // ASSERT
        assertNotNull(bankAccounts);
        assertTrue(bankAccounts.size() >= 1);

        for(BankAccountBankingModel bankAccountBankingModel : bankAccounts) {
            assertEquals(bankAccountBankingModel.getBankAccessId(), bankAccessBankingModel.getId());
        }
    }

    @Test
    public void getBankAccounts_accountExistsNot() throws Exception {
        // SETUP
        String testUserId = "userId";
        DummyBankAccessEndpoint dummyBankAccessEndpoint = new DummyBankAccessEndpoint();
        String accessId = "access";

        DummyBankAccountEndpoint dummyBankAccountEndpoint = new DummyBankAccountEndpoint(dummyBankAccessEndpoint);

        // ACT
        List<BankAccountBankingModel> bankAccounts = dummyBankAccountEndpoint.getBankAccounts(testUserId, accessId);

        // ASSERT
        assertNotNull(bankAccounts);
        assertTrue(bankAccounts.size() == 0);
    }

    @Test
    public void syncBankAccount() throws Exception {
    }

}<commit_msg>added tests for DummyBankAccountEndpoint sync<commit_after>package de.fau.amos.virtualledger.server.banking.adorsys.api.bankAccountEndpoint;

import de.fau.amos.virtualledger.server.banking.adorsys.api.bankAccessEndpoint.DummyBankAccessEndpoint;
import de.fau.amos.virtualledger.server.banking.model.BankAccessBankingModel;
import de.fau.amos.virtualledger.server.banking.model.BankAccountBankingModel;
import de.fau.amos.virtualledger.server.banking.model.BookingModel;
import org.junit.Test;

import javax.validation.constraints.AssertTrue;
import java.util.List;

import static org.junit.Assert.*;

/**
 * Created by Georg on 27.06.2017.
 */
public class DummyBankAccountEndpointTest {
    @Test
    public void getBankAccounts_accountExists() throws Exception {
        // SETUP
        String testUserId = "userId";
        DummyBankAccessEndpoint dummyBankAccessEndpoint = new DummyBankAccessEndpoint();
        dummyBankAccessEndpoint.addBankAccess(testUserId, new BankAccessBankingModel());
        BankAccessBankingModel bankAccessBankingModel = dummyBankAccessEndpoint.getBankAccesses(testUserId).get(0);

        DummyBankAccountEndpoint dummyBankAccountEndpoint = new DummyBankAccountEndpoint(dummyBankAccessEndpoint);

        // ACT
        List<BankAccountBankingModel> bankAccounts = dummyBankAccountEndpoint.getBankAccounts(testUserId, bankAccessBankingModel.getId());

        // ASSERT
        assertNotNull(bankAccounts);
        assertTrue(bankAccounts.size() >= 1);

        for(BankAccountBankingModel bankAccountBankingModel : bankAccounts) {
            assertEquals(bankAccountBankingModel.getBankAccessId(), bankAccessBankingModel.getId());
        }
    }

    @Test
    public void getBankAccounts_accountExistsNot() throws Exception {
        // SETUP
        String testUserId = "userId";
        DummyBankAccessEndpoint dummyBankAccessEndpoint = new DummyBankAccessEndpoint();
        String accessId = "access";

        DummyBankAccountEndpoint dummyBankAccountEndpoint = new DummyBankAccountEndpoint(dummyBankAccessEndpoint);

        // ACT
        List<BankAccountBankingModel> bankAccounts = dummyBankAccountEndpoint.getBankAccounts(testUserId, accessId);

        // ASSERT
        assertNotNull(bankAccounts);
        assertTrue(bankAccounts.size() == 0);
    }

    @Test
    public void syncBankAccount_accountExistsNot() throws Exception {
        // SETUP
        String testUserId = "userId";
        DummyBankAccessEndpoint dummyBankAccessEndpoint = new DummyBankAccessEndpoint();
        String accessId = "access";

        DummyBankAccountEndpoint dummyBankAccountEndpoint = new DummyBankAccountEndpoint(dummyBankAccessEndpoint);

        // ACT
        List<BookingModel> bookingModelList = dummyBankAccountEndpoint.syncBankAccount(testUserId, accessId, "dummy", "dummy");

        // ASSERT
        assertNotNull(bookingModelList);
        assertTrue(bookingModelList.size() == 0);
    }

    @Test
    public void syncBankAccounts_accountExists() throws Exception {
        // SETUP
        String testUserId = "userId";
        DummyBankAccessEndpoint dummyBankAccessEndpoint = new DummyBankAccessEndpoint();
        dummyBankAccessEndpoint.addBankAccess(testUserId, new BankAccessBankingModel());
        BankAccessBankingModel bankAccessBankingModel = dummyBankAccessEndpoint.getBankAccesses(testUserId).get(0);

        DummyBankAccountEndpoint dummyBankAccountEndpoint = new DummyBankAccountEndpoint(dummyBankAccessEndpoint);
        List<BankAccountBankingModel> bankAccounts = dummyBankAccountEndpoint.getBankAccounts(testUserId, bankAccessBankingModel.getId());
        assertTrue(bankAccounts.size() >= 1);

        // ACT
        List<BookingModel> bookingModelList = dummyBankAccountEndpoint.syncBankAccount(testUserId, bankAccessBankingModel.getId(), bankAccounts.get(0).getId(), "dummy");

        // ASSERT
        assertNotNull(bookingModelList);
        assertTrue(bookingModelList.size() >= 1);
    }
}
{'fraction_non_alphanumeric': 0.08391157011457157, 'fraction_numerical': 0.004356946909795062, 'mean_word_length': 4.092851273623665, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 14, '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': '2411441', 'n_tokens_mistral': 1661, 'n_tokens_neox': 1650, 'n_words': 269}