use of org.candlepin.pinsetter.core.model.JobStatus in project candlepin by candlepin.
the class PinsetterTriggerListenerTest method triggerMisfireRunAgain.
@Test
public void triggerMisfireRunAgain() {
PinsetterTriggerListener ptl = new PinsetterTriggerListener(modeManager, jobCurator);
Trigger trigger = mock(Trigger.class);
JobStatus jobStatus = new JobStatus();
JobKey jobKey = new JobKey("mockName");
when(trigger.mayFireAgain()).thenReturn(true);
when(trigger.getJobKey()).thenReturn(jobKey);
when(trigger.getNextFireTime()).thenReturn(new Date());
when(jobCurator.find(Matchers.anyString())).thenReturn(jobStatus);
ptl.triggerMisfired(trigger);
assert (jobStatus.getResult().startsWith("Will reattempt job at or after"));
assert (jobStatus.getState().equals(JobStatus.JobState.PENDING));
}
Aggregations