@Test
public void testGetEndOfMonth() {

    Calendar calendar = createCalendar(2010, 7, 14, 15, 24, 53);
    Date date = calendar.getTime();
    Date end = TimeUtil.getEndOfMonth(date);
    calendar.setTime(end);
    assertEquals(2010, calendar.get(Calendar.YEAR));
    assertEquals(8, calendar.get(Calendar.MONTH));
    assertEquals(1, calendar.get(Calendar.DAY_OF_MONTH));
    assertEquals(0, calendar.get(Calendar.HOUR_OF_DAY));
    assertEquals(0, calendar.get(Calendar.MINUTE));
    assertEquals(0, calendar.get(Calendar.SECOND));
    assertEquals(0, calendar.get(Calendar.MILLISECOND));
    calendar = createCalendar(2010, 8, 14, 15, 24, 53);
    date = calendar.getTime();
    end = TimeUtil.getEndOfMonth(date);
    calendar.setTime(end);
    assertEquals(2010, calendar.get(Calendar.YEAR));
    assertEquals(9, calendar.get(Calendar.MONTH));
    assertEquals(1, calendar.get(Calendar.DAY_OF_MONTH));
    assertEquals(0, calendar.get(Calendar.HOUR_OF_DAY));
    assertEquals(0, calendar.get(Calendar.MINUTE));
    assertEquals(0, calendar.get(Calendar.SECOND));
    assertEquals(0, calendar.get(Calendar.MILLISECOND));
}