<commit_before>package ru.matevosyan.start;

import org.junit.Test;
import ru.matevosyan.models.Item;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.*;

/**
 * Class StartUITest created for testing.
 * Created on 07.12.2016.
 * @since 1.0
 * @version 1.0
 * @author <NAME>
 */

public class StartUITest {
    @Test
    public void whenCreateItemThenSaveInTracker() {

        String[] answers = {

            "1", // select menu 1. add item
            "task 1", // items name
            "task desc", // items desc
            "n" // exit
        };

        Input stub = new StubInput(answers);
        Tracker tracker = new Tracker();

        new StartUI(stub, tracker).init();
        Item item = tracker.findByName("task 1");
        assertThat(item.getName(), is("task 1"));
    }
}<commit_msg>add StartUITest.java<commit_after>package ru.matevosyan.start;

import org.junit.Test;
import ru.matevosyan.models.Item;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.*;

/**
 * Class StartUITest created for testing.
 * Created on 07.12.2016.
 * @since 1.0
 * @version 1.0
 * @author <NAME>
 */

public class StartUITest {

    @Test
    public void whenCreateItemThenFindByNameInTracker() {

        String[] answers = {

            "1", // select menu 1. add item
            "task 1", // items name
            "task desc", // items desc
            "n" // exit
        };

        Input stub = new StubInput(answers);
        Tracker tracker = new Tracker();
        new StartUI(stub, tracker).init();
        Item item = tracker.findByName("task 1");

        assertThat(item.getName(), is("task 1"));
    }

    @Test
    public void whenCreateItemThenFindByIdTracker() {

        String[] answer = {
                "1",
                "task 2",
                "task desc",
                "n"
        };

        Input stub = new StubInput(answer);
        Tracker tracker = new Tracker();
        new StartUI(stub, tracker).init();

        for (Item item : tracker.getAll()){
            item = tracker.findById(item.getId());

            assertThat(item, is(tracker.getAll()[0]));
        }


    }

    @Test
    public void whenCreateItemThenFindByDateTracker() {

        String[] answer = {
                "1",
                "task 3",
                "task desc",
                "n"
        };

        Input stub = new StubInput(answer);
        Tracker tracker = new Tracker();
        new StartUI(stub, tracker).init();

        for (Item item : tracker.getAll()){
            item = tracker.findByDate(item.getCreate());

            assertThat(item, is(tracker.getAll()[0]));
        }


    }

    @Test
    public void whenCreateItemThenEditTracker() {

        String id = "0";
        Tracker tracker = new Tracker();

        for (Item item : tracker.getAll()){
            id = item.getId();
        }

        String[] answer = {
                "1",
                "task 3",
                "task desc",
                "y",
                "2",
                id,
                "task 4",
                "task desc",
                "n"
        };

        Input stub = new StubInput(answer);
        new StartUI(stub, tracker).init();

        for (Item item : tracker.getAll()){
           assertThat(item.getName(), is("task 4"));
        }


    }
}
{'fraction_non_alphanumeric': 0.12913808529674917, 'fraction_numerical': 0.013719057560393677, 'mean_word_length': 1.6725099601593625, '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': '3401249', 'n_tokens_mistral': 1042, 'n_tokens_neox': 948, 'n_words': 247}