### Question:
RollingCalendar extends GregorianCalendar { public PeriodicityType getPeriodicityType() { return periodicityType; } RollingCalendar(String datePattern);  RollingCalendar(String datePattern, TimeZone tz, Locale locale); PeriodicityType getPeriodicityType(); PeriodicityType computePeriodicityType(); boolean isCollisionFree(); void printPeriodicity(ContextAwareBase cab); Date getEndOfNextNthPeriod(Date now, int numPeriods); Date getNextTriggeringDate(Date now); Date normalizeDate(Date date);  }### Answer:
@Test public void testMillisecondPeriodicity() { { RollingCalendar rc = new RollingCalendar("yyyy-MM-dd-S"); assertEquals(PeriodicityType.TOP_OF_MILLISECOND, rc.getPeriodicityType()); } { RollingCalendar rc = new RollingCalendar("yyyy-MM-dd-SS"); assertEquals(PeriodicityType.TOP_OF_MILLISECOND, rc.getPeriodicityType()); } { RollingCalendar rc = new RollingCalendar("yyyy-MM-dd-SSS"); assertEquals(PeriodicityType.TOP_OF_MILLISECOND, rc.getPeriodicityType()); } }
@Test public void testPeriodicity() { { RollingCalendar rc = new RollingCalendar("yyyy-MM-dd_HH_mm_ss"); assertEquals(PeriodicityType.TOP_OF_SECOND, rc.getPeriodicityType()); } { RollingCalendar rc = new RollingCalendar("yyyy-MM-dd_HH_mm"); assertEquals(PeriodicityType.TOP_OF_MINUTE, rc.getPeriodicityType()); } { RollingCalendar rc = new RollingCalendar("yyyy-MM-dd_HH"); assertEquals(PeriodicityType.TOP_OF_HOUR, rc.getPeriodicityType()); } { RollingCalendar rc = new RollingCalendar("yyyy-MM-dd_hh"); assertEquals(PeriodicityType.TOP_OF_HOUR, rc.getPeriodicityType()); } { RollingCalendar rc = new RollingCalendar("yyyy-MM-dd"); assertEquals(PeriodicityType.TOP_OF_DAY, rc.getPeriodicityType()); } { RollingCalendar rc = new RollingCalendar("yyyy-MM"); assertEquals(PeriodicityType.TOP_OF_MONTH, rc.getPeriodicityType()); } { RollingCalendar rc = new RollingCalendar("yyyy-ww"); assertEquals(PeriodicityType.TOP_OF_WEEK, rc.getPeriodicityType()); } { RollingCalendar rc = new RollingCalendar("yyyy-WW"); assertEquals(PeriodicityType.TOP_OF_WEEK, rc.getPeriodicityType()); } }