<commit_before>package com.acme.commerce;

import com.acme.commerce.vendingmachine.Change;
import com.acme.commerce.vendingmachine.Product;
import com.acme.commerce.vendingmachine.VendingMachine;
import com.acme.commerce.vendingmachine.exception.ChangeNotAcceptedException;
import com.acme.commerce.vendingmachine.exception.InsufficientChangeException;
import com.acme.commerce.vendingmachine.exception.OutOfStockException;
import com.acme.commerce.vendingmachine.impl.VendingMachineImpl;
import org.junit.Ignore;
import org.junit.Test;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static org.junit.Assert.*;

/**
 * @author <NAME>
 * @since 1.0
 */
public class VendingMachineTest {
    @Test
    public void addingMoneyUpdatesTotal() {
        VendingMachine vendingMachine = new VendingMachineImpl();
        int changeRunningTotal = 0;

        try {
            vendingMachine.insertChange(Change.TEN_PENCE);
            vendingMachine.insertChange(Change.TEN_PENCE);
            vendingMachine.insertChange(Change.TEN_PENCE);
            vendingMachine.insertChange(Change.TEN_PENCE);
            vendingMachine.insertChange(Change.TEN_PENCE);
            vendingMachine.insertChange(Change.TEN_PENCE);
            changeRunningTotal = vendingMachine.insertChange(Change.ONE_POUND);
        } catch (ChangeNotAcceptedException e) {
            // @todo Determine what to do in this instance.
        }

        assertEquals(60 + 100, changeRunningTotal);
        assertEquals(10 + 10 + 10 + 10 + 10 + 10 + 100, vendingMachine.getBalance()); // Should both be the same result
    }

    @Test
    public void defaultAcceptedCoinCountIsFour() {
        VendingMachine vendingMachine = new VendingMachineImpl();
        List<Change> acceptedChange = vendingMachine.getAcceptedChange();

        assertTrue(4 == acceptedChange.size());
    }

    @Test
    public void defaultAcceptedCoinList() {
        List<Change> expectedList = new ArrayList<>();
        expectedList.add(Change.TEN_PENCE);<commit_msg>Added addingUnacceptedChangeIsNotAllowed test method with passing test.<commit_after>package com.acme.commerce;

import com.acme.commerce.vendingmachine.Change;
import com.acme.commerce.vendingmachine.Product;
import com.acme.commerce.vendingmachine.VendingMachine;
import com.acme.commerce.vendingmachine.exception.ChangeNotAcceptedException;
import com.acme.commerce.vendingmachine.exception.InsufficientChangeException;
import com.acme.commerce.vendingmachine.exception.OutOfStockException;
import com.acme.commerce.vendingmachine.impl.VendingMachineImpl;
import org.junit.Ignore;
import org.junit.Test;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static org.junit.Assert.*;

/**
 * @author <NAME>
 * @since 1.0
 */
public class VendingMachineTest {
    @Test
    public void addingMoneyUpdatesTotal() {
        VendingMachine vendingMachine = new VendingMachineImpl();
        int changeRunningTotal = 0;

        try {
            vendingMachine.insertChange(Change.TEN_PENCE);
            vendingMachine.insertChange(Change.TEN_PENCE);
            vendingMachine.insertChange(Change.TEN_PENCE);
            vendingMachine.insertChange(Change.TEN_PENCE);
            vendingMachine.insertChange(Change.TEN_PENCE);
            vendingMachine.insertChange(Change.TEN_PENCE);
            changeRunningTotal = vendingMachine.insertChange(Change.ONE_POUND);
        } catch (ChangeNotAcceptedException e) {
            // Hopefully we're inserting all the correct change in this test.
        }

        assertEquals(60 + 100, changeRunningTotal);
        assertEquals(10 + 10 + 10 + 10 + 10 + 10 + 100, vendingMachine.getBalance()); // Should both be the same result
    }

    @Test
    public void addingUnacceptedChangeIsNotAllowed() {
        VendingMachine vendingMachine = new VendingMachineImpl();
        int changeRunningTotal = 0;

        try {
            changeRunningTotal = vendingMachine.insertChange(Change.ONE_PENCE);

            fail("ChangeNotAcceptedException was expected.");
        } catch (ChangeNotAcceptedException e) {
            // Empty body - exists due to fail above being executed only when we don't arrive in this exception.
        }
    }

    @Test
    public void defaultAcceptedCoinCountIsFour() {
        VendingMachine vendingMachine = new VendingMachineImpl();
        List<Change> acceptedChange = vendingMachine.getAcceptedChange();

        assertTrue(4 == acceptedChange.size());
    }

    @Test
    public void defaultAcceptedCoinList() {
        List<Change> expectedList = new ArrayList<>();
        expectedList.add(Change.TEN_PENCE);
{'fraction_non_alphanumeric': 0.09165961049957663, 'fraction_numerical': 0.010372565622353938, 'mean_word_length': 3.48292220113852, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '1458652', 'n_tokens_mistral': 1363, 'n_tokens_neox': 1304, 'n_words': 260}