@Test
public void toFiveMinutes() throws Exception {

    // 1 five minute block
    DateTimePeriod period0 = DateTimePeriod.createFiveMinutes(2009, 1, 1, 0, 0, DateTimeZone.UTC);
    List<DateTimePeriod> periods = period0.toFiveMinutes();
    Assert.assertArrayEquals(new DateTimePeriod[] {
            DateTimePeriod.createFiveMinutes(2009, 1, 1, 0, 0, DateTimeZone.UTC)
        }, periods.toArray(new DateTimePeriod[0]));
    // multiple 5 minutes span (a little more than 5 mins)
    period0 = new DateTimeFiveMinutes(new DateTime(2009,1,1,0,0,0,0,DateTimeZone.UTC), new DateTime(2009,1,1,0,10,0,0,DateTimeZone.UTC));
    periods = period0.toPeriods(DateTimeDuration.FIVE_MINUTES);
    Assert.assertArrayEquals(new DateTimePeriod[] {
            DateTimePeriod.createFiveMinutes(2009, 1, 1, 0, 0, DateTimeZone.UTC),
            DateTimePeriod.createFiveMinutes(2009, 1, 1, 1, 5, DateTimeZone.UTC)
        }, periods.toArray(new DateTimePeriod[0]));
    // no five minutes (partial 5 minutes such as 1 minute)
    period0 = new DateTimeFiveMinutes(new DateTime(2009,1,1,0,0,0,0,DateTimeZone.UTC), new DateTime(2009,1,1,0,4,59,999,DateTimeZone.UTC));
    periods = period0.toFiveMinutes();
    Assert.assertArrayEquals(new DateTimePeriod[] {}, periods.toArray(new DateTimePeriod[0]));
}