Skip to content

Commit

Permalink
[AMQ-8354] Fix sequence storage tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaShupletsov committed Aug 7, 2024
1 parent ab93e03 commit d6dea41
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,16 @@ public void shouldInitializeWhenMoreThanOneExist() throws Exception {
.thenReturn(List.of(new IndirectMessageReference(message1), new IndirectMessageReference(message2)));

String initialize = replicaSequenceStorage.initialize(connectionContext);
assertThat(initialize).isEqualTo(message1.getText());
verify(sequenceQueue, times(1)).removeMessage(eq(message1.getMessageId().toString()));
assertThat(initialize).isEqualTo(message2.getText());

ArgumentCaptor<MessageAck> ackArgumentCaptor = ArgumentCaptor.forClass(MessageAck.class);
verify(broker).acknowledge(any(), ackArgumentCaptor.capture());
MessageAck value = ackArgumentCaptor.getValue();
assertThat(value.getFirstMessageId()).isEqualTo(message1.getMessageId());
assertThat(value.getLastMessageId()).isEqualTo(message1.getMessageId());
assertThat(value.getDestination()).isEqualTo(sequenceQueueDestination);
assertThat(value.getMessageCount()).isEqualTo(1);
assertThat(value.getAckType()).isEqualTo(MessageAck.STANDARD_ACK_TYPE);
}

@Test
Expand Down Expand Up @@ -145,7 +153,7 @@ public void shouldAcknowledgeAllMessagesWhenEnqueue() throws Exception {
when(messageReference2.getMessage()).thenReturn(message2);
when(messageReference2.getMessageId()).thenReturn(message2.getMessageId());

when(subscription.getDispatched()).thenReturn(List.of(messageReference1, messageReference2));
when(subscription.getDispatched()).thenReturn(List.of(), List.of(messageReference1, messageReference2));
replicaSequenceStorage.initialize(connectionContext);

ArgumentCaptor<MessageAck> ackArgumentCaptor = ArgumentCaptor.forClass(MessageAck.class);
Expand Down

0 comments on commit d6dea41

Please sign in to comment.