package ru.agolovin;

import org.junit.Test;

import java.util.Calendar;
import java.util.GregorianCalendar;

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

/**
 * @author agolovin (agolovin@list.ru)
 * @version $Id$
 * @since 0.1
 */
public class UserTest {

    /**
     * Test user class.
     */
    @Test
    public void thenAddUserThneGetInformation() {
        Calendar calc = new GregorianCalendar();
        String name = "Name";
        int children = 2;
        User user = new User(name, children, calc);
        assertThat(user.getName(), is(name));
        assertThat(user.getChildren(), is(children));
        assertThat(user.getBirthday(), is(calc));
    }

}
@@ -101,16 +101,64 @@
 alendar;
+%0Aimport java.util.HashMap;%0Aimport java.util.Map;
 %0A%0Aimport
@@ -337,16 +337,134 @@
 Test %7B%0A%0A
+    private Calendar calc = new GregorianCalendar();%0A    private String name = %22Name%22;%0A    private int children = 2;%0A%0A
     /**%0A
@@ -555,24 +555,25 @@
 ion() %7B%0A
+%0A
         
 Calendar
@@ -568,90 +568,391 @@
     
-Calendar calc = new GregorianCalendar();%0A        String name = %22Name%22;%0A        int
+User user = new User(name, children, calc);%0A        assertThat(user.getName(), is(name));%0A        assertThat(user.getChildren(), is(children));%0A        assertThat(user.getBirthday(), is(calc));%0A    %7D%0A%0A%0A    /**%0A     * Test add user to map w/o override equals and hashcode.%0A     */%0A    @Test%0A    public void thenAddSameUserToMapThenItContainsOne() %7B%0A        User user1 = new User(name,
  chi
@@ -956,20 +956,23 @@
 children
- = 2
+, calc)
 ;%0A      
@@ -974,32 +974,33 @@
        User user
+2
  = new User(name
@@ -1030,96 +1030,357 @@
     
-assertThat(user.getName(), is(name));%0A        assertThat(user.getChildren(), is(children
+Map%3CUser, Object%3E map = new HashMap%3C%3E();%0A        Integer item = 1;%0A        map.put(user1, item);%0A        map.put(user2, item);%0A%0A        System.out.println(%22Map contains: %22);%0A        for (Map.Entry%3CUser, Object%3E pair : map.entrySet()) %7B%0A            User key = pair.getKey();%0A            System.out.println(String.format(%22User name: %25s%22, key.getName()
 ));%0A
@@ -1391,54 +1391,99 @@
     
-assertThat(user.getBirthday(), is(calc));%0A    %7D%0A%0A%7D
+    System.out.println(String.format(%22User child: %25s%22, key.getChildren()));%0A        %7D%0A%0A    %7D%0A%7D%0A

add task2 in part5 chapter5 package2