@Test public void testNoMoreTournamentsAfterEndDate() { Date start = new DateTime(2012, 6, 5, 9, 0, 0).toDate(); Date end = new DateTime(2012, 7, 5, 9, 0, 0).toDate(); TournamentSchedule tournamentSchedule = new TournamentSchedule(start, end, "0 30 14 * * ?", 10, 20, 30); DateTime nextAnnounceTime = tournamentSchedule.getNextAnnounceTime(new DateTime(2012, 7, 9, 9, 0, 0)); assertNull("Should be null, but was " + nextAnnounceTime, nextAnnounceTime); }
@Test public void test10MinuteSchedule() { Date start = new DateTime(2011, 7, 5, 9, 0, 0).toDate(); Date end = new DateTime(2013, 7, 5, 9, 0, 0).toDate(); TournamentSchedule tournamentSchedule = new TournamentSchedule(start, end, "0 */10 * * * ?", 3, 5, 5); DateTime nextAnnounceTime = tournamentSchedule.getNextStartTime(new DateTime(2012, 7, 9, 15, 3, 0)); assertEquals(new DateTime(2012, 7, 9, 15, 10, 0), nextAnnounceTime); }
@Test public void testNextAnnounceTime() { Date startDate = new DateTime(2011, 7, 5, 9, 0, 0).toDate(); Date endDate = new DateTime(2012, 7, 5, 9, 0, 0).toDate(); TournamentSchedule tournamentSchedule = new TournamentSchedule(startDate, endDate, "0 30 14 * * ?", 10, 20, 30); DateTime nextAnnounceTime = tournamentSchedule.getNextAnnounceTime(new DateTime(2012, 6, 2, 9, 0, 0)); assertEquals(new DateTime(2012, 6, 2, 14, 0, 0), nextAnnounceTime); }