package kata.eom;

import org.junit.Test;

import java.util.Calendar;
import java.util.Date;

import static org.junit.Assert.assertEquals;

public class TestEomUtil {

    @Test
    public void test135781012 () {
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.YEAR, 2013);
        calendar.set(Calendar.MONTH, 0);
        calendar.set(Calendar.DATE, 12);
        Date eom = EomUtil.getEndDateOfMonth(calendar.getTime());
        Calendar target = Calendar.getInstance();
        target.setTime(eom);
        assertEquals(2013, target.get(Calendar.YEAR));
        assertEquals(0, target.get(Calendar.MONTH));
        assertEquals(31, target.get(Calendar.DATE));
    }

    public void test46911() {

        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.YEAR, 2013);
        calendar.set(Calendar.MONTH, 3);
        calendar.set(Calendar.DATE, 15);
        Date eom = EomUtil.getEndDateOfMonth(calendar.getTime());
        Calendar target = Calendar.getInstance();
        target.setTime(eom);
        assertEquals(2013, target.get(Calendar.YEAR));
        assertEquals(3, target.get(Calendar.MONTH));
        assertEquals(30, target.get(Calendar.DATE));
    }

    public void test2() {
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.YEAR, 2013);
        calendar.set(Calendar.MONTH, 1);
        calendar.set(Calendar.DATE, 15);
        Date eom = EomUtil.getEndDateOfMonth(calendar.getTime());
        Calendar target = Calendar.getInstance();
        target.setTime(eom);
        assertEquals(2013, target.get(Calendar.YEAR));
        assertEquals(1, target.get(Calendar.MONTH));
        assertEquals(28, target.get(Calendar.DATE));
    }

    public void testLeap2() {
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.YEAR, 2013);
        calendar.set(Calendar.MONTH, 1);
        calendar.set(Calendar.DATE, 15);
        Date eom = EomUtil.getEndDateOfMonth(calendar.getTime());
        Calendar target = Calendar.getInstance();
        target.setTime(eom);
        assertEquals(2012, target.get(Calendar.YEAR));
        assertEquals(1, target.get(Calendar.MONTH));
        assertEquals(29, target.get(Calendar.DATE));
    }

}

@@ -541,32 +541,53 @@
    assertEquals(
+%22year is different%22, 
 2013, target.get
@@ -625,16 +625,38 @@
 tEquals(
+%22month is different%22, 
 0, targe
@@ -700,16 +700,37 @@
 tEquals(
+%22date is different%22, 
 31, targ
@@ -752,32 +752,42 @@
 .DATE));%0A    %7D%0A%0A
+    @Test%0A
     public void 
@@ -1136,32 +1136,53 @@
    assertEquals(
+%22year is different%22, 
 2013, target.get
@@ -1220,16 +1220,38 @@
 tEquals(
+%22month is different%22, 
 3, targe
@@ -1295,16 +1295,37 @@
 tEquals(
+%22date is different%22, 
 30, targ
@@ -1347,32 +1347,42 @@
 .DATE));%0A    %7D%0A%0A
+    @Test%0A
     public void 
@@ -1734,16 +1734,37 @@
 tEquals(
+%22year is different%22, 
 2013, ta
@@ -1802,32 +1802,54 @@
    assertEquals(
+%22month is different%22, 
 1, target.get(Ca
@@ -1885,16 +1885,37 @@
 tEquals(
+%22date is different%22, 
 28, targ
@@ -1941,24 +1941,34 @@
 E));%0A    %7D%0A%0A
+    @Test%0A
     public v
@@ -2328,16 +2328,37 @@
 tEquals(
+%22year is different%22, 
 2012, ta
@@ -2404,16 +2404,38 @@
 tEquals(
+%22month is different%22, 
 1, targe
@@ -2479,16 +2479,37 @@
 tEquals(
+%22date is different%22, 
 29, targ

Append test messages.