package ru.matevosyan;

import org.junit.Test;

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

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

public class UserConverterTest {

    @Test
    public void whenPassArrayThanCheckList() {

        //assign
        User admin = new User(1, "Tom", "LA");
        User firsUser = new User(2, "Vova", "Moscow");
        User secondUser = new User(3, "Vardan", "Dzhanfida");

        List<User> userList = new ArrayList<>();
        HashMap<Integer, User> actualUserMap;

        UserConverter convertList = new UserConverter();

        //act
        userList.add(admin);
        userList.add(firsUser);
        userList.add(secondUser);

        actualUserMap = convertList.process(userList);

        //assert
        Iterator<Map.Entry<Integer, User>> hashMap = actualUserMap.entrySet().iterator();
        Iterator<User> userValues = userList.iterator();

        while (hashMap.hasNext() && userValues.hasNext()) {
            Map.Entry<Integer, User> userEntry = hashMap.next();
            User userArrayList = userValues.next();
            assertThat(userEntry.getKey(), is(userArrayList.getId()));
            assertThat(userEntry.getValue().getName(), is(userArrayList.getName()));
        }

    }



}
@@ -860,25 +860,9 @@
 );%0A%0A
-        //assert
 %0A
+
     
@@ -1001,24 +1001,41 @@
 terator();%0A%0A
+        //assert%0A
         whil
@@ -1082,16 +1082,17 @@
 xt()) %7B%0A
+%0A
         
@@ -1192,32 +1192,33 @@
 rValues.next();%0A
+%0A
             asse
@@ -1268,24 +1268,24 @@
 .getId()));%0A
-
             
@@ -1353,24 +1353,25 @@
 etName()));%0A
+%0A
         %7D%0A%0A 

change assert comment