### Question:
QuarterlyExpiryDayValidator extends SixMonthlyExpiryDayValidator { @Override protected int plusMonths() { return 3; } QuarterlyExpiryDayValidator(int expiryDays, String period); @Override String getDateFormat();  }### Answer:
@Test public void testCanNotEditPreviousPeriodEndsSameTodayMinusDifferenceExpiryDays() { LocalDate periodDate = new LocalDate(); int previousPeriodStart = getPreviousPeriodStart(); periodDate = periodDate.withMonthOfYear(monthStart(previousPeriodStart)).withDayOfMonth(1); int expiryDays = Days.daysBetween(periodDate.plusMonths(3), new LocalDate()).getDays(); QuarterlyExpiryDayValidator monthlyExpiryDayValidator = new QuarterlyExpiryDayValidator( expiryDays, periodDate.toString(PATTERN) + previousPeriodStart); assertFalse(monthlyExpiryDayValidator.canEdit()); }
@Test public void testCanEditPreviousPeriodEndsSameTodayMinusDifferencePlusTwoExpiryDays() { LocalDate periodDate = new LocalDate(); int previousPeriodStart = getPreviousPeriodStart(); periodDate = periodDate.withMonthOfYear(monthStart(previousPeriodStart)).withDayOfMonth(1); int expiryDays = Days.daysBetween(periodDate.plusMonths(3), new LocalDate()).getDays() + 2; QuarterlyExpiryDayValidator monthlyExpiryDayValidator = new QuarterlyExpiryDayValidator( expiryDays, periodDate.toString(PATTERN) + previousPeriodStart); assertTrue(monthlyExpiryDayValidator.canEdit()); }
@Test public void testCanNotEditPreviousPeriodEndsSameTodayMinusDifferencePlusOneExpiryDays() { LocalDate periodDate = new LocalDate(); int previousPeriodStart = getPreviousPeriodStart(); periodDate = periodDate.withMonthOfYear(monthStart(previousPeriodStart)).withDayOfMonth(1); int expiryDays = Days.daysBetween(periodDate.plusMonths(3), new LocalDate()).getDays() + 1; QuarterlyExpiryDayValidator monthlyExpiryDayValidator = new QuarterlyExpiryDayValidator( expiryDays, periodDate.toString(PATTERN) + previousPeriodStart); assertFalse(monthlyExpiryDayValidator.canEdit()); }
@Test public void testCanNotEditPreviousPeriodEndsSameTodayMinusExpiryDaysMinusOne() { LocalDate periodDate = new LocalDate(); int previousPeriodStart = getPreviousPeriodStart(); periodDate = periodDate.withMonthOfYear(monthStart(previousPeriodStart)).withDayOfMonth(1); int expiryDays = Days.daysBetween(periodDate.plusMonths(3), new LocalDate()).getDays() - 1; QuarterlyExpiryDayValidator monthlyExpiryDayValidator = new QuarterlyExpiryDayValidator( expiryDays, periodDate.toString(PATTERN) + previousPeriodStart); assertFalse(monthlyExpiryDayValidator.canEdit()); }