package ru.job4j.convertlist;

import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import static org.junit.Assert.assertEquals;

/**
 * Класс ConvertListTest тестирует класс ConvertList.
 *
 * @author Goureyev Ilya (mailto:ill-jah@yandex.ru)
 * @version 1
 * @since 2017-05-10
 */
public class ConvertListTest {
    /**
     * Тестирует toList().
     */
    @Test
    public void testToList() {
        int[] vals = new int[]{1, 2, 3, 4, 5, 6, 7, 0, 0};
        List<Integer> expected = new ArrayList<>();
        for (int a = 0; a < vals.length; a++) {
            expected.add(vals[a]);
        }
        int[][] array = new int[][]{{1, 2, 3}, {4, 5, 6}, {7, 0, 0}};
        ConvertList cl = new ConvertList();
        List result = cl.toList(array);
        assertEquals(expected, result);
    }
    /**
     * Тестирует toArray().
     */
    @Test
    public void testToArray() {
        int[][] expected = new int[][]{{1, 2, 3}, {4, 5, 6}, {7, 0, 0}};
        int[] vals = new int[]{1, 2, 3, 4, 5, 6, 7};
        List<Integer> list = new ArrayList<>();
        for (int a = 0; a < vals.length; a++) {
            list.add(vals[a]);
        }
        ConvertList cl = new ConvertList();
        int[][] result = cl.toArray(list, 3);
        assertEquals(expected, result);
    }
}
@@ -51,24 +51,50 @@
 ArrayList;%0D%0A
+import java.util.Arrays;%0D%0A
 import java.
@@ -469,207 +469,91 @@
     
-int%5B%5D vals = new int%5B%5D%7B1, 2, 3, 4, 5, 6, 7, 0, 0%7D;%0D%0A        List%3CInteger%3E expected = new ArrayList%3C%3E();%0D%0A        for (int a = 0; a %3C vals.length; a++) %7B%0D%0A            expected.add(vals%5Ba%5D);%0D%0A        %7D
+List%3CInteger%3E expected = new ArrayList%3C%3E(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 0, 0));
 %0D%0A  

task 10035. junior.pack1.p5.ch1.task1.3 v2