package ru.job4j.Tracker;

import org.junit.Test;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

public class TrackerTest {
    @Test
    public void whenAddNewItemThenTrackerHasSameItem() {
        Tracker tracker = new Tracker();
        Item item = new Item("test1", "1", "test1", " this test Tracker1", 2005-03-27);
        tracker.add(item);
        assertThat(tracker.findAll()[0], is(item));
    }

    @Test
    public void whenAddNewItemThenTrackerHasSameItem1() {
        Tracker tracker = new Tracker();
        Item item = new Item("test2", "2", "test2", " this test Tracker2", 2005-03-27);
        tracker.add(item);
        assertThat(tracker.findById("2"), is(item));
    }

    @Test
    public void whenAddNewItemThenTrackerHasSameItem2() {
        Tracker tracker = new Tracker();
        Item item = new Item("test3", "3", "test3", " this test Tracker3", 2005-03-27);
        tracker.add(item);
        assertThat(tracker.findByName("test3"), is(item));
    }

    @Test
    public void whenAddNewItemThenTrackerHasSameItem3() {
        Tracker tracker = new Tracker();
        Item item = new Item("test4", "4", "test4", " this test Tracker4", 2005-03-27);
        Item item1 = new Item("test94", "8", "test8", " this test Tracker8", 2005-03-27);
        tracker.update(item1);
        assertThat(tracker.findById("4"), is(item));
    }

    @Test
    public void whenAddNewItemThenTrackerHasSameItem4() {
        Tracker tracker = new Tracker();
        Item item = new Item("test5", "5", "test5", " this test Tracker5", 2005-03-27);
        tracker.delete("5");
        assertThat(tracker.findById("5"), is(item));
    }
}

@@ -1289,32 +1289,59 @@
 %22, 2005-03-27);%0A
+        tracker.add(item);%0A
         tracker.
@@ -1396,32 +1396,33 @@
 Id(%224%22), is(item
+1
 ));%0A    %7D%0A%0A    @

change for class StartUI