Created
March 9, 2013 18:53
-
-
Save jaredstehler/5125259 to your computer and use it in GitHub Desktop.
This test mysteriously began failing for me on 9 March, 2013, at 1:51PM EST...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static org.fest.assertions.api.Assertions.assertThat; | |
import java.util.Date; | |
import org.joda.time.DateTime; | |
import org.joda.time.Interval; | |
import org.junit.After; | |
import org.junit.Before; | |
import org.junit.Test; | |
import org.quartz.Trigger; | |
import com.fiestacabin.dropwizard.quartz.ManagedScheduler; | |
import com.fiestacabin.dropwizard.quartz.Scheduled; | |
public class MyFailingDateTest { | |
@Test | |
public void shouldFireDaily() throws Exception { | |
// @Scheduled(cron="0 0 0 * * ?") | |
Scheduled s = PasswordExpirationJob.class.getAnnotation(Scheduled.class); | |
Trigger t = ManagedScheduler.buildTrigger(s); | |
Date start = t.getStartTime(); | |
Date next = t.getFireTimeAfter(start); | |
start = next; | |
next = t.getFireTimeAfter(start); | |
Interval i = new Interval(start.getTime(), next.getTime()); | |
assertThat(i.toDuration().getStandardDays()).isEqualTo(1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment