package ru.job4j.collection;


import org.junit.Test;

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

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

public class UserConvertTestTest {


    /**
     * we test method convert list of User to HashMap.
     */
    @Test
        public void whenConvertListUserToHashMap() {
        UserConvert forConvertUser = new UserConvert();
        List<User> listUser = new ArrayList<>();
        List<User> expected = new ArrayList<>();
        listUser.add(new User(0, "Ivan", "Moscow"));
        listUser.add(new User(1, "Liza", "Moscow"));
        listUser.add(new User(2, "Robert", "Norilsk"));
        listUser.add(new User(3, "Yana", "Tula"));
        expected = listUser;
        forConvertUser.process(listUser);
        Map<Integer, User> result = forConvertUser.process(listUser);
        System.out.print(forConvertUser.usersList);
        assertThat(result.get(0), is( expected.get(0)));
    }






}
@@ -72,24 +72,50 @@
 .ArrayList;%0A
+import java.util.HashMap;%0A
 import java.
@@ -121,24 +121,24 @@
 .util.List;%0A
-
 import java.
@@ -553,32 +553,95 @@
  ArrayList%3C%3E();%0A
+        HashMap%3CInteger, User%3E expectedd = new HashMap%3C%3E();%0A%0A%0A%0A
         listUser
@@ -866,16 +866,297 @@
 stUser;%0A
+        expectedd.put(((listUser.get(0)).getId()),(listUser.get(0)));%0A        expectedd.put(((listUser.get(1)).getId()),(listUser.get(1)));%0A        expectedd.put(((listUser.get(2)).getId()),(listUser.get(2)));%0A        expectedd.put(((listUser.get(3)).getId()),(listUser.get(3)));%0A%0A
         
@@ -1311,16 +1311,16 @@
 sList);%0A
-
         
@@ -1364,24 +1364,67 @@
 d.get(0)));%0A
+        assertThat(result, is(expectedd));%0A
     %7D%0A%0A%0A%0A%0A%0A%0A

add C:\projects\Sirotkin_M\chapter_002\src\test\java\ru\job4j\collection\UserConvertTestTest.java_4