@Test
public void toDays() throws Exception {

    // 1 day
    DateTimePeriod period0 = DateTimePeriod.createDay(2009, 1, 1, DateTimeZone.UTC);
    List<DateTimePeriod> periods = period0.toDays();
    Assert.assertArrayEquals(new DateTimePeriod[] {
            DateTimePeriod.createDay(2009, 1, 1, DateTimeZone.UTC)
        }, periods.toArray(new DateTimePeriod[0]));
    // multiple days (a little more than a day)
    period0 = new DateTimeDay(new DateTime(2009,1,1,0,0,0,0,DateTimeZone.UTC), new DateTime(2009,1,3,1,0,0,0,DateTimeZone.UTC));
    periods = period0.toPeriods(DateTimeDuration.DAY);
    Assert.assertArrayEquals(new DateTimePeriod[] {
            DateTimePeriod.createDay(2009, 1, 1, DateTimeZone.UTC),
            DateTimePeriod.createDay(2009, 1, 2, DateTimeZone.UTC)
        }, periods.toArray(new DateTimePeriod[0]));
    // no days (partial day such as a hour)
    period0 = DateTimePeriod.createHour(2009, 1, 1, 0, DateTimeZone.UTC);
    periods = period0.toDays();
    Assert.assertArrayEquals(new DateTimePeriod[] {}, periods.toArray(new DateTimePeriod[0]));
}