Skip to content

Commit

Permalink
Fix flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamHawtin committed Apr 19, 2024
1 parent 16c9bbf commit b72174f
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ class EqLaunchSenderTest {
@InjectMocks EqLaunchSender underTest;

@Test
public void testMessageSent() throws JsonProcessingException {
void testMessageSent() throws JsonProcessingException {
Map<String, Object> payload = new HashMap<>();
payload.put("qid", TEST_QID);
payload.put("tx_id", CORRELATION_ID);
OffsetDateTime testStart = OffsetDateTime.now();

ReflectionTestUtils.setField(underTest, "eqLaunchTopic", TEST_TOPIC);

Expand All @@ -56,8 +57,7 @@ public void testMessageSent() throws JsonProcessingException {
assertThat(eventHeaderDTO.getTopic()).isEqualTo(TEST_TOPIC);
assertThat(eventHeaderDTO.getSource()).isEqualTo("RESPONDENT HOME");
assertThat(eventHeaderDTO.getChannel()).isEqualTo("RH");
assertThat(eventHeaderDTO.getDateTime())
.isCloseTo(OffsetDateTime.now(), within(5, ChronoUnit.SECONDS));
assertThat(eventHeaderDTO.getDateTime()).isBetween(testStart, OffsetDateTime.now());
assertThat(eventHeaderDTO.getMessageId()).isNotNull();
assertThat(eventHeaderDTO.getCorrelationId()).isEqualTo(CORRELATION_ID);
assertThat(eventHeaderDTO.getOriginatingUser()).isEqualTo("RH");
Expand Down

0 comments on commit b72174f

Please sign in to comment.