From a08c3333401743fc117007bcf21f2874cf60643c Mon Sep 17 00:00:00 2001 From: Matt Peterson Date: Thu, 1 Aug 2024 17:21:20 -0600 Subject: [PATCH] wip: try reordering the operations on the test Signed-off-by: Matt Peterson --- .../server/mediator/LiveStreamMediatorImplTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/src/test/java/com/hedera/block/server/mediator/LiveStreamMediatorImplTest.java b/server/src/test/java/com/hedera/block/server/mediator/LiveStreamMediatorImplTest.java index 26c9c2306..9d0a3d33a 100644 --- a/server/src/test/java/com/hedera/block/server/mediator/LiveStreamMediatorImplTest.java +++ b/server/src/test/java/com/hedera/block/server/mediator/LiveStreamMediatorImplTest.java @@ -224,12 +224,12 @@ public void testOnCancelSubscriptionHandling() throws IOException { final List blockItems = generateBlockItems(1); streamMediator.publishEvent(blockItems.getFirst()); - // Verify the event made it to the consumer - verify(serverCallStreamObserver, timeout(50).times(1)).setOnCancelHandler(any()); - // Simulate the consumer cancelling the stream testConsumerBlockItemObserver.getOnCancel().run(); + // Verify the event made it to the consumer + verify(serverCallStreamObserver, timeout(50).times(1)).setOnCancelHandler(any()); + // Confirm the mediator unsubscribed the consumer assertFalse(streamMediator.isSubscribed(testConsumerBlockItemObserver)); } @@ -258,12 +258,12 @@ public void testOnCloseSubscriptionHandling() throws IOException { final List blockItems = generateBlockItems(1); streamMediator.publishEvent(blockItems.getFirst()); - // Verify the event made it to the consumer - verify(serverCallStreamObserver, timeout(50).times(1)).setOnCancelHandler(any()); - // Simulate the consumer completing the stream testConsumerBlockItemObserver.getOnClose().run(); + // Verify the event made it to the consumer + verify(serverCallStreamObserver, timeout(50).times(1)).setOnCancelHandler(any()); + // Confirm the mediator unsubscribed the consumer assertFalse(streamMediator.isSubscribed(testConsumerBlockItemObserver)); }