@Test
public void floorToMonth() throws Exception {

    // create a reference datetime
    DateTime dt0 = new DateTime(2009,6,24,23,30,30,789,DateTimeZone.forID("America/Los_Angeles"));
    //
    // floor to nearest month
    //
    DateTime dt1 = DateTimeUtil.floorToMonth(dt0);
    Assert.assertEquals(2009, dt1.getYear());
    Assert.assertEquals(6, dt1.getMonthOfYear());
    Assert.assertEquals(1, dt1.getDayOfMonth());
    Assert.assertEquals(0, dt1.getHourOfDay());
    Assert.assertEquals(0, dt1.getMinuteOfHour());
    Assert.assertEquals(0, dt1.getSecondOfMinute());
    Assert.assertEquals(0, dt1.getMillisOfSecond());
    Assert.assertEquals(DateTimeZone.forID("America/Los_Angeles"), dt1.getZone());
    //
    // floor null
    //
    DateTime dt2 = DateTimeUtil.floorToMonth(null);
    Assert.assertNull(dt2);
}