### Question:
DateUtils { public static Period getPeriod( String perStr ){ org.joda.time.Period pr; if( perStr.contains("a") || perStr.contains("g") || perStr.contains("s") ){ pr = FMT_TR.parsePeriod(perStr).toPeriod(); } else { pr = FMT_EN.parsePeriod(perStr).toPeriod(); } return pr; }  static Period getPeriod( String perStr ); static Date getDateAfterPeriod(String perStr, Date curDate); static Date getDateBeforePeriod(String perStr, Date curDate); static ScheduleExpression getScheduleExpression( String cron ); static ScheduleExpression getHourlyScheduleExpression( Date date ); static ScheduleExpression getDailyScheduleExpression( Date date ); static ScheduleExpression getWeeklyScheduleExpression( Date date ); static ScheduleExpression getMonthlyScheduleExpression( Date date ); static DateTimeFormatter getDateTimeFormatter(); static String dateToStr( Date date);  }### Answer:
@Test public void testGetPeriodi18n2() { Period expected = new Period(0, 0, 0, 0, 1, 5, 0, 0); Period per = DateUtils.getPeriod("1s5d"); Assert.assertEquals(expected, per); per = DateUtils.getPeriod("1h5M"); Assert.assertEquals(expected, per); }
@Test public void testGetPeriodSimple() { Period expected = new Period(0, 0, 0, 2, 3, 0, 0, 0); Period per = DateUtils.getPeriod("2g3s"); Assert.assertEquals(expected, per); per = DateUtils.getPeriod("2d3h"); Assert.assertEquals(expected, per); }
@Test public void testGetPeriodFull() { Period expected = new Period(1, 2, 3, 4, 5, 6, 0, 0); Period per = DateUtils.getPeriod("1y2a3h4g5s6d"); Assert.assertEquals(expected, per); per = DateUtils.getPeriod("1y2m3w4d5h6M"); Assert.assertEquals(expected, per); }
@Test public void testGetPeriodi18n() { Period expected = new Period(1, 0, 3, 0, 0, 0, 0, 0); Period per = DateUtils.getPeriod("1y0a3h"); Assert.assertEquals(expected, per); per = DateUtils.getPeriod("1y3w"); Assert.assertEquals(expected, per); }