package ru.job4j.collections.convert;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

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

/**
 * This class is test class of Convert class.
 *
 * @author Kucykh Vasily (mailto:basil135@mail.ru)
 * @version $Id$
 * @since 07.05.2017
 */
public class ConvertTest {

    /**
     * method tests double array convert to list of integers.
     */
    @Test
    public void whenArrayToListThenWrightList() {

        Convert convert = new Convert();

        int[][] testArray = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};

        List<Integer> expectedList = new ArrayList<>();
        List<Integer> actualList = convert.toList(testArray);

        for (int count = 1; count < 10; count++) {
            expectedList.add(count);
        }

        assertThat(actualList, is(expectedList));

    }

    /**
     * method tests that list of seven integers convert to double array of integers with three rows.
     */
    @Test
    public void whenListOfSevenIntegersThenDoubleArrayOfNineIntegersInThreeRows() {

        Convert convert = new Convert();

        List<Integer> testList = new ArrayList<>();

        for (int count = 1; count < 8; count++) {
            testList.add(count);
        }

        int[][] expectedArray = {{1, 2, 3}, {4, 5, 6}, {7, 0, 0}};
        int[][] actualArray = convert.toArray(testList, 3);

        assertThat(actualArray, is(expectedArray));

    }

    /**
     * method tests that list of fifteen integers convert to double array of integers with four rows.
     */
    @Test
    public void whenListOfFifteenIntegersThenSixteenIntegersInFourRows() {

        Convert convert = new Convert();

        List<Integer> testList = new ArrayList<>();

        for (int count = 1; count < 16; count++) {
            testList.add(count);
        }

        int[][] expectedArray = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}, {13, 14, 15, 0}};
        int[][] actualArray = convert.toArray(testList, 4);

        assertThat(actualArray, is(expectedArray));

    }

}

@@ -2086,10 +2086,688 @@
 %0A    %7D%0A%0A
+    /**%0A     * method tests that list of array of integers convert to list of integers.%0A     */%0A    @Test%0A    public void whenListOfThreeArrayOfIntegersThenOneListOfIntegers() %7B%0A%0A        Convert convert = new Convert();%0A%0A        List%3Cint%5B%5D%3E testList = new ArrayList%3C%3E();%0A%0A        testList.add(new int%5B%5D %7B1, 2%7D);%0A        testList.add(new int%5B%5D %7B3, 4, 5, 6%7D);%0A        testList.add(new int%5B%5D %7B7, 8, 9%7D);%0A%0A        List%3CInteger%3E expectedList = new ArrayList%3C%3E();%0A        List%3CInteger%3E actualList = convert.convert(testList);%0A%0A        for (int count = 1; count %3C 10; count++) %7B%0A            expectedList.add(count);%0A        %7D%0A%0A        assertThat(actualList, is(expectedList));%0A%0A    %7D%0A%0A
 %7D%0A

Refactor ConvertTest.java add new test method