### Question:
PeriodUtil { public static boolean isValidPeriod(final String period){ if (period!=null && !period.equals("") && !yearFromPeriod(period).equals(new LocalDateInterval(null, null))){ return true; } return false; }  static LocalDate startDateFromPeriod(final String period); static LocalDate endDateFromPeriod(final String period); static LocalDateInterval fromPeriod(final String period); static LocalDateInterval yearFromPeriod(final String period); static String periodFromInterval(@NotNull final LocalDateInterval interval); static boolean isValidPeriod(final String period); static String reasonInvalidPeriod(final String period); static Pattern financialYearPattern; static Pattern yearPattern; }### Answer:
@Test public void isValidPeriod() throws Exception { String period; period = "f2017M01"; Assertions.assertThat(PeriodUtil.isValidPeriod(period)).isEqualTo(false); Assertions.assertThat(PeriodUtil.reasonInvalidPeriod(period)).isEqualTo("Not a valid period; use four digits of the year with optional prefix F for a financial year (for example: F2017)"); period = "F2017M01"; Assertions.assertThat(PeriodUtil.isValidPeriod(period)).isEqualTo(true); Assertions.assertThat(PeriodUtil.reasonInvalidPeriod(period)).isNull(); period = ""; Assertions.assertThat(PeriodUtil.isValidPeriod(period)).isEqualTo(false); period = null; Assertions.assertThat(PeriodUtil.isValidPeriod(period)).isEqualTo(false); }