package ru.job4j.convert;

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

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

public class ConvertListTest {

    @Test
    public void whenToList() {
        ConvertList convertList = new ConvertList();
        int[][] array = {{1, 2, 3}, {4, 5, 6}, {7, 0 ,0}};
        List<Integer> result = convertList.toList(array);
        List<Integer> expected = new ArrayList<>();
        expected.add(1);
        expected.add(2);
        expected.add(3);
        expected.add(4);
        expected.add(5);
        expected.add(6);
        expected.add(7);
        assertThat(result, is(expected));
    }

    @Test
    public void whenToArray() {
        ConvertList convertList = new ConvertList();
        List<Integer> list = new ArrayList<>();
        list.add(1);
        list.add(2);
        list.add(null);
        list.add(3);
        list.add(4);
        list.add(5);
        list.add(6);
        list.add(7);
        int[][] result = convertList.toArray(list, 3);
        int[][] expected = {{1, 2, 3}, {4, 5, 6}, {7, 0 ,0}};
        assertThat(result, is(expected));
    }
}

@@ -150,24 +150,49 @@
 .ArrayList;%0A
+import java.util.Arrays;%0A
 import java.
@@ -202,16 +202,16 @@
 l.List;%0A
-
 %0Apublic 
@@ -522,160 +522,52 @@
 .add
-(1);%0A        expected.add(2);%0A        expected.add(3);%0A        expected.add(4);%0A        expected.add(5);%0A        expected.add(6);%0A        expected.add(7
+All(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 0, 0)
 );%0A 
@@ -777,160 +777,52 @@
 .add
-(1);%0A        list.add(2);%0A        list.add(null);%0A        list.add(3);%0A        list.add(4);%0A        list.add(5);%0A        list.add(6);%0A        list.add(7
+All(Arrays.asList(1, 2, null, 3, 4, 5, 6, 7)
 );%0A 

task 10035