Skip to content

Commit

Permalink
Test that the submission status updater ignores submissions outside t…
Browse files Browse the repository at this point in the history
…he date window
  • Loading branch information
markpatton committed Mar 6, 2024
1 parent 02fd701 commit 844bd85
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.mock.mockito.MockBean;

/**
Expand All @@ -46,6 +47,9 @@ public class SubmissionStatusUpdaterIT extends AbstractSubmissionIT {
@Autowired private SubmissionStatusUpdater submissionStatusUpdater;
@MockBean private SubmissionStatusService statusService;

@Value("${pass.status.update.window.days}")
private long updateWindowDays;

private Submission submission;

@BeforeEach
Expand Down Expand Up @@ -137,4 +141,20 @@ void testDoUpdate_Success_NoUpdateNotSubmitted() throws IOException {
// THEN
verify(passClient, times(0)).updateObject(any());
}

@Test
void testDoUpdate_Success_OutSideDateWindow() throws IOException {
// GIVEN
submission.setSubmissionStatus(SubmissionStatus.SUBMITTED);
submission.setSubmitted(true);
submission.setSubmittedDate(ZonedDateTime.now().minusDays(updateWindowDays + 1));
passClient.updateObject(submission);
Mockito.clearInvocations(passClient);

// WHEN
submissionStatusUpdater.doUpdate();

// THEN
verify(passClient, times(0)).updateObject(any());
}
}

0 comments on commit 844bd85

Please sign in to comment.