Skip to content

Commit

Permalink
[fix][test] Don't reuse AsyncResponse mocks in PersistentTopicsTest (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
lhotari authored Dec 20, 2023
1 parent 69a45a1 commit b944f10
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ public void testTerminate() {
persistentTopics.createNonPartitionedTopic(response, testTenant, testNamespace, testLocalTopicName, true, null);

// 2) Create a subscription
response = mock(AsyncResponse.class);
persistentTopics.createSubscription(response, testTenant, testNamespace, testLocalTopicName, "test", true,
new ResetCursorData(MessageId.earliest), false);
ArgumentCaptor<Response> responseCaptor = ArgumentCaptor.forClass(Response.class);
Expand Down Expand Up @@ -539,12 +540,13 @@ public void testCreateNonPartitionedTopic() {

@Test
public void testCreatePartitionedTopic() {
AsyncResponse response = mock(AsyncResponse.class);
ArgumentCaptor<PartitionedTopicMetadata> responseCaptor =
ArgumentCaptor.forClass(PartitionedTopicMetadata.class);
final String topicName = "standard-partitioned-topic-a";
persistentTopics.createPartitionedTopic(response, testTenant, testNamespace, topicName, 2, true);
persistentTopics.createPartitionedTopic(mock(AsyncResponse.class), testTenant, testNamespace, topicName, 2,
true);
Awaitility.await().untilAsserted(() -> {
ArgumentCaptor<PartitionedTopicMetadata> responseCaptor =
ArgumentCaptor.forClass(PartitionedTopicMetadata.class);
AsyncResponse response = mock(AsyncResponse.class);
persistentTopics.getPartitionedMetadata(response,
testTenant, testNamespace, topicName, true, false);
verify(response, timeout(5000).atLeast(1)).resume(responseCaptor.capture());
Expand Down

0 comments on commit b944f10

Please sign in to comment.