package ru.matevosyan;

import org.junit.Test;

import java.util.ArrayList;

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


/**
 * EvenNumberTest class.
 * Created on 28.04.2017.
 * @author Matevosyan Vardan
 * @version 1.0
 */

public class EvenNumberTest {

    /**
     * whenPassArrayThanIterateAndReturnTheSameValue was created to test two methods.
     * in {@link EvenNumber}. When passing square array, program iterate through all elements.
     * and return each of them, finally test check if our expected value is equal to actual value.
     */

    @Test
    public void whenPassArrayThanIterateAndReturnTheSameValue() {
        int[] actualArray = new int[]{1, 2, 3, 4};
        EvenNumber evenNumberIterator = new EvenNumber(actualArray);

        ArrayList<Integer> actualValue = new ArrayList<>();

        ArrayList<Integer> expected = new ArrayList<>();
        expected.add(2);
        expected.add(4);

        while (evenNumberIterator.hasNext()) {
            actualValue.add(evenNumberIterator.next());
        }

        assertThat(actualValue, is(expected));
    }

    /**
     * whenPassArrayThanCheckHasNextReturnValueIs was created to test hasNext methods.
     * in {@link EvenNumber}. When passing square array, program iterate through all elements.
     * and return each of them, finally test check if we has more element to get? then get it and check one more.
     * to be shore that is not there.
     */

    @Test
    public void whenPassArrayThanCheckHasNextReturnValueIs() {
        int[] actualArray = new int[]{1, 2, 3, 4};
        EvenNumber evenNumberIterator = new EvenNumber(actualArray);

        ArrayList<Integer> arrayList = new ArrayList<>();
        arrayList.add(2);
        arrayList.add(4);

        boolean actual = evenNumberIterator.hasNext();
        evenNumberIterator.next();
        evenNumberIterator.next();
        boolean checkIndexOutElement = evenNumberIterator.hasNext();

        assertThat(actual, is(true));

        assertThat(checkIndexOutElement, is(false));
    }

    /**
     * whenPassArrayWithOneElementThanCheckHasNextReturnValueIs was created to test hasNext methods.
     * in {@link EvenNumber}. When passing array, program iterate through all elements.
     * and return each of them, finally test check if we has more element to get, if we have, then true, else false.
     */

    @Test
    public void whenPassArrayWithOneElementThanCheckHasNextReturnValueIs() {
        int[] actualArray = new int[]{1};
        EvenNumber evenNumberIterator = new EvenNumber(actualArray);

        boolean actual = evenNumberIterator.hasNext();

        assertThat(actual, is(true));

    }

    /**
     * whenPassArrayWithoutElementThanCheckHasNextReturnValueIs was created to test hasNext methods.
     * in {@link EvenNumber}. When passing array, program iterate through all elements.
     * and return each of them, finally test check if we has more element to get, if we have, then true, else false.
     */

    @Test
    public void whenPassArrayWithoutElementThanCheckHasNextReturnValueIs() {
        int[] actualArray = new int[]{};
        EvenNumber evenNumberIterator = new EvenNumber(actualArray);

        boolean actual = evenNumberIterator.hasNext();

        assertThat(actual, is(false));

    }

}
@@ -1261,114 +1261,9 @@
 r%7D. 
-When passing square array, program iterate through all elements.%0A     * and return each of them, finally t
+T
 est 
@@ -1288,22 +1288,26 @@
 re e
-lement
+ven number
  to get
-?
+,
  the
@@ -1587,136 +1587,8 @@
     
- ArrayList%3CInteger%3E arrayList = new ArrayList%3C%3E();%0A        arrayList.add(2);%0A        arrayList.add(4);%0A%0A        boolean actual =
  eve
@@ -1758,47 +1758,8 @@
 );%0A%0A
-        assertThat(actual, is(true));%0A%0A
     
@@ -1957,107 +1957,9 @@
 r%7D. 
-When passing array, program iterate through all elements.%0A     * and return each of them, finally t
+T
 est 
@@ -1966,36 +1966,43 @@
 check if we has 
-more
+even number
  element to get,
@@ -2331,19 +2331,20 @@
 ual, is(
-tru
+fals
 e));%0A%0A  
@@ -2559,36 +2559,40 @@
  and return 
-each of them
+only even number
 , finally te

change javadoc.java