<commit_before>package com.sepoe.wbitdd.pos;

import org.junit.Test;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

/**
 * Class to ...
 *
 * @author lumiha
 * @since 15/05/15.
 */
public class SellingMultipleItemsTest {
    private static final int BARCODE_IDX = 0;
    private static final int PRICE_IDX = 1;
    private MockOutputDevice display = new MockOutputDevice();
    private final MockItemRepository mockItemRepository = new MockItemRepository();
    private PointOfSale pos = new PointOfSale(mockItemRepository, display);

    private BarcodeGenerator barcodeGenerator = new BarcodeGenerator();

    @Test
    public void onTotal_forNoItmems_returnsMessage() {
        pos.onTotal();
        assertThat(display.getOutputToWrite(), is("No sale in progress. Try scanning a product"));
    }

    @Test
    public void onTotal_withOneItemFound_resultsInPriceOfItem() {
        final String barcode = "123456";
        mockItemRepository.when(barcode, 8.50);
        pos.onBarcode(barcode);
        pos.onTotal();
        assertThat(display.getOutputToWrite(), is("Total $8.50"));
    }

    @Test
    public void onTotal_forThreeFoundItems_resultsInTotal() {
        final String[] barcodes = generateBarcodes();

        register(barcodes);

        scan(barcodes);
<commit_msg>added several items not found test<commit_after>package com.sepoe.wbitdd.pos;

import org.junit.Test;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

/**
 * Class to ...
 *
 * @author lumiha
 * @since 15/05/15.
 */
public class SellingMultipleItemsTest {
    private MockOutputDevice display = new MockOutputDevice();
    private final MockItemRepository mockItemRepository = new MockItemRepository();
    private PointOfSale pos = new PointOfSale(mockItemRepository, display);

    private BarcodeGenerator barcodeGenerator = new BarcodeGenerator();

    @Test
    public void onTotal_forNoItems_returnsMessage() {
        pos.onTotal();
        assertThat(display.getOutputToWrite(), is("No sale in progress. Try scanning a product"));
    }

    @Test
    public void onTotal_whenSeveralItemsAreNotFound_returnsScanMessage() {
        pos.onBarcode(barcodeGenerator.generateBarCode());
        pos.onBarcode(barcodeGenerator.generateBarCode());
        pos.onBarcode(barcodeGenerator.generateBarCode());
        pos.onTotal();
        assertThat(display.getOutputToWrite(), is("No sale in progress. Try scanning a product"));
    }

    @Test
    public void onTotal_withOneItemFound_resultsInPriceOfItem() {
        final String barcode = "123456";
        mockItemRepository.when(barcode, 8.50);
        pos.onBarcode(barcode);
        pos.onTotal();
        assertThat(display.getOutputToWrite(), is("Total $8.50"));
    }

    @Test
    public void onTotal_forThreeFoundItems_resultsInTotal() {
        final String[] barcodes = generateBarcodes();

        register(barcodes);

        scan(barcodes);

{'fraction_non_alphanumeric': 0.09930023325558147, 'fraction_numerical': 0.012662445851382872, 'mean_word_length': 3.6398763523956723, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '257429', 'n_tokens_mistral': 888, 'n_tokens_neox': 858, 'n_words': 194}