package ru.apetrov.list;

import org.junit.Test;

import java.util.Iterator;

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

/**
 * Created by Andrey on 13.03.2017.
 */
public class SimpleLinkedListTest {

    @Test
    public void whenAddNewElementThenChekThisElement() {
        SimpleLinkedList<String> list = new SimpleLinkedList<>();
        list.add("test");
        list.add("test");

        assertThat(list.get(1), is("test"));
    }

    @Test
    public void whenNotHasNextThenGetFalse() {
        SimpleLinkedList<String> list = new SimpleLinkedList<>();
        list.add("test");
        list.add("test");
        Iterator<String> iterator = list.iterator();
        iterator.next();
        iterator.next();
        assertFalse(iterator.hasNext());

    }    @Test
    public void whenHasNextThenGetTrue() {
        SimpleLinkedList<String> list = new SimpleLinkedList<>();
        list.add("test");
        list.add("test");
        Iterator<String> iterator = list.iterator();
        iterator.next();
        assertTrue(iterator.hasNext());
    }

}
@@ -373,32 +373,33 @@
   list.add(%22test
+1
 %22);%0A        list
@@ -404,24 +404,25 @@
 st.add(%22test
+2
 %22);%0A%0A       
@@ -454,16 +454,17 @@
 is(%22test
+2
 %22));%0A   

update SimpleLinkedList