SixMonthlyAprilPeriodType extends SixMonthlyAbstractPeriodType { @Override public String getIsoDate( DateTimeUnit dateTimeUnit, Calendar calendar ) { int month = dateTimeUnit.getMonth(); if ( dateTimeUnit.isIso8601() ) { month = calendar.fromIso( dateTimeUnit ).getMonth(); } switch ( month ) { case 4: return dateTimeUnit.getYear() + "AprilS1"; case 10: return dateTimeUnit.getYear() + "AprilS2"; default: throw new IllegalArgumentException( "Month not valid [4,10]" ); } }  @Override String getName(); @Override int getBaseMonth(); @Override String getIsoDate( DateTimeUnit dateTimeUnit, Calendar calendar ); @Override String getIsoFormat(); @Override String getIso8601Duration(); static final String NAME; }
@Test public void testGetIsoDate() { testDate = new DateTime( 2015, 2, 1, 0 ,0 ); startDate = new DateTime( 2014, 10, 1, 0 ,0 ); endDate = new DateTime( 2015, 3, 31, 0, 0 ); Period period = periodType.createPeriod( testDate.toDate() ); assertEquals( startDate.toDate(), period.getStartDate() ); assertEquals( endDate.toDate(), period.getEndDate() ); }