CronExpression implements Serializable { public String getExpressionSummary() { StringBuffer buf = new StringBuffer(); buf.append("seconds: "); buf.append(getExpressionSetSummary(seconds)); buf.append("\n"); buf.append("minutes: "); buf.append(getExpressionSetSummary(minutes)); buf.append("\n"); buf.append("hours: "); buf.append(getExpressionSetSummary(hours)); buf.append("\n"); buf.append("daysOfMonth: "); buf.append(getExpressionSetSummary(daysOfMonth)); buf.append("\n"); buf.append("months: "); buf.append(getExpressionSetSummary(months)); buf.append("\n"); buf.append("daysOfWeek: "); buf.append(getExpressionSetSummary(daysOfWeek)); buf.append("\n"); buf.append("lastdayOfWeek: "); buf.append(lastdayOfWeek); buf.append("\n"); buf.append("nearestWeekday: "); buf.append(nearestWeekday); buf.append("\n"); buf.append("NthDayOfWeek: "); buf.append(nthdayOfWeek); buf.append("\n"); buf.append("lastdayOfMonth: "); buf.append(lastdayOfMonth); buf.append("\n"); buf.append("years: "); buf.append(getExpressionSetSummary(years)); buf.append("\n"); return buf.toString(); } CronExpression(String cronExpression); String toString(); static boolean isValidExpression(String cronExpression); String getCronExpression(); String getExpressionSummary();  }
@Test public void testGetExpressionSummary() throws Exception { String value1 = "8 15 10 25 3 ? 2005"; String expectedSummary1 = "seconds: 8" + "\n" + "minutes: 15" + "\n" + "hours: 10" + "\n" + "daysOfMonth: 25" + "\n" + "months: 3" + "\n" + "daysOfWeek: ?" + "\n" + "lastdayOfWeek: false" + "\n" + "nearestWeekday: false" + "\n" + "NthDayOfWeek: 0" + "\n" + "lastdayOfMonth: false" + "\n" + "years: 2005" + "\n"; assertEquals(expectedSummary1, new CronExpression(value1).getExpressionSummary()); String value2 = "5 10 20 ? * MON,WED 2015"; String expectedSummary2 = "seconds: 5" + "\n" + "minutes: 10" + "\n" + "hours: 20" + "\n" + "daysOfMonth: ?" + "\n" + "months: *" + "\n" + "daysOfWeek: 2,4" + "\n" + "lastdayOfWeek: false" + "\n" + "nearestWeekday: false" + "\n" + "NthDayOfWeek: 0" + "\n" + "lastdayOfMonth: false" + "\n" + "years: 2015" + "\n"; assertEquals(expectedSummary2, new CronExpression(value2).getExpressionSummary()); }