package ru.spoddubnyak;

import org.junit.Test;

import java.util.ArrayList;

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

/**
 * Class test class IteratorMultiArray.
 *
 * @author Sergei Poddubnyak (forvvard09@gmail.com)
 * @version 1.0
 * @since 24.04.2017
 */
public class IteratorMultiArrayTest {

    /**
     * Test class IteratorMultiArray.
     */
    @Test
    public void whenArrayMatrixThenGetExpectedResult() {
        final int[][] arrayValue = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
        final int[] expectedResult = {1, 2, 3, 4, 5, 6, 7, 8, 9};
        IteratorMultiArray it = new IteratorMultiArray(arrayValue);
        ArrayList listResult = new ArrayList(9);
        while (it.hasNext()) {
            listResult.add(it.hasNext());
        }
        assertThat(expectedResult, containsInAnyOrder(listResult));
    }
}
@@ -46,37 +46,8 @@
 t;%0A%0A
-import java.util.ArrayList;%0A%0A
 impo
@@ -126,35 +126,18 @@
 est.
-Matchers.containsInAnyOrder
+core.Is.is
 ;%0A%0A/
@@ -358,16 +358,32 @@
 ltiArray
+ values - matrix
 .%0A     *
@@ -667,196 +667,1501 @@
     
-ArrayList listResult = new ArrayList(9);%0A        while (it.hasNext()) %7B%0A            listResult.add(it.hasNext());%0A        %7D%0A        assertThat(expectedResult, containsInAnyOrder(listResult
+final int lengthArr = 9;%0A        int%5B%5D result = new int%5BlengthArr%5D;%0A        int count = 0;%0A        while (it.hasNext()) %7B%0A            result%5Bcount++%5D = (int) it.next();%0A        %7D%0A        assertThat(expectedResult, is(result));%0A    %7D%0A%0A    /**%0A     * Test class IteratorMultiArray, values - multidimensional array.%0A     */%0A    @Test%0A    public void whenArrayThenGetExpectedResult() %7B%0A        final int%5B%5D%5B%5D arrayValue = %7B%7B1, 2%7D, %7B3, 4, 5%7D, %7B6, 7, 8, 9%7D%7D;%0A        final int%5B%5D expectedResult = %7B1, 2, 3, 4, 5, 6, 7, 8, 9%7D;%0A        IteratorMultiArray it = new IteratorMultiArray(arrayValue);%0A        final int lengthArr = 9;%0A        int%5B%5D result = new int%5BlengthArr%5D;%0A        int count = 0;%0A        while (it.hasNext()) %7B%0A            result%5Bcount++%5D = (int) it.next();%0A        %7D%0A        assertThat(expectedResult, is(result));%0A    %7D%0A%0A    /**%0A     * Test class IteratorMultiArray, not next element by hashNext false.%0A     */%0A    @Test%0A    public void whenNotNextElementThenGetHashNextFalse() %7B%0A        final int%5B%5D%5B%5D arrayValue = %7B%7B1%7D%7D;%0A        IteratorMultiArray it = new IteratorMultiArray(arrayValue);%0A        it.next();%0A        assertThat(it.hasNext(), is(false));%0A    %7D%0A%0A    /**%0A     * Test class IteratorMultiArray,  next element by hashNext true.%0A     */%0A    @Test%0A    public void whenNextElementThenGetHashNextTrue() %7B%0A        final int%5B%5D%5B%5D arrayValue = %7B%7B1%7D, %7B2%7D%7D;%0A        IteratorMultiArray it = new IteratorMultiArray(arrayValue);%0A        it.next();%0A        assertThat(it.hasNext(), is(true
 ));%0A

Update tests task01. Theme Collections.Pro. Iterator.