@Test(dataProvider = "matches") public void testMatches(String cronExpression, String dateString, boolean match, boolean error) throws ParseException { CronSyntaxException exception = null; try { Cron cron = Cron.compile(cronExpression); Assert.assertEquals(cron.matches(DF.parse(dateString)), match); } catch (CronSyntaxException e) { exception = e; } if (exception != null && !error) { Assert.fail("find exception", exception); } }
public boolean matches(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); for (int i = 0; i < 7; i++) { Field field = fields[i]; if (null != field && !field.isBlank() && !field.matches(calendar)) { return false; } } return true; }
Cron { public boolean matches(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); for (int i = 0; i < 7; i++) { Field field = fields[i]; if (null != field && !field.isBlank() && !field.matches(calendar)) { return false; } } return true; } }
Cron { public boolean matches(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); for (int i = 0; i < 7; i++) { Field field = fields[i]; if (null != field && !field.isBlank() && !field.matches(calendar)) { return false; } } return true; } private  Cron(String expression); }
Cron { public boolean matches(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); for (int i = 0; i < 7; i++) { Field field = fields[i]; if (null != field && !field.isBlank() && !field.matches(calendar)) { return false; } } return true; } private  Cron(String expression); static Cron compile(String cronExpression); boolean matches(Date date); Date next(Date date); String getExpression(); Field[] getFields(); @Override int hashCode(); @Override boolean equals(Object obj); }
Cron { public boolean matches(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); for (int i = 0; i < 7; i++) { Field field = fields[i]; if (null != field && !field.isBlank() && !field.matches(calendar)) { return false; } } return true; } private  Cron(String expression); static Cron compile(String cronExpression); boolean matches(Date date); Date next(Date date); String getExpression(); Field[] getFields(); @Override int hashCode(); @Override boolean equals(Object obj);  }