@@ -56,6 +56,8 @@ public class LiveStreamMediatorImplTest {
56
56
private final long TIMEOUT_THRESHOLD_MILLIS = 100L ;
57
57
private final long TEST_TIME = 1_719_427_664_950L ;
58
58
59
+ private static final int testTimeout = 200 ;
60
+
59
61
@ Test
60
62
public void testUnsubscribeEach () throws InterruptedException {
61
63
@@ -76,7 +78,7 @@ public void testUnsubscribeEach() throws InterruptedException {
76
78
streamMediator .isSubscribed (observer3 ),
77
79
"Expected the mediator to have observer3 subscribed" );
78
80
79
- Thread .sleep (50L );
81
+ Thread .sleep (testTimeout );
80
82
81
83
streamMediator .unsubscribe (observer1 );
82
84
assertFalse (
@@ -152,9 +154,9 @@ public void testMediatorPublishEventToSubscribers() throws IOException, Interrup
152
154
streamMediator .publish (blockItem );
153
155
154
156
// Confirm each subscriber was notified of the new block
155
- verify (streamObserver1 , timeout (50 ).times (1 )).onNext (subscribeStreamResponse );
156
- verify (streamObserver2 , timeout (50 ).times (1 )).onNext (subscribeStreamResponse );
157
- verify (streamObserver3 , timeout (50 ).times (1 )).onNext (subscribeStreamResponse );
157
+ verify (streamObserver1 , timeout (testTimeout ).times (1 )).onNext (subscribeStreamResponse );
158
+ verify (streamObserver2 , timeout (testTimeout ).times (1 )).onNext (subscribeStreamResponse );
159
+ verify (streamObserver3 , timeout (testTimeout ).times (1 )).onNext (subscribeStreamResponse );
158
160
159
161
// Confirm the BlockStorage write method was called
160
162
verify (blockWriter ).write (blockItem );
@@ -213,7 +215,7 @@ public void testOnCancelSubscriptionHandling() throws IOException {
213
215
testConsumerBlockItemObserver .getOnCancel ().run ();
214
216
215
217
// Verify the event made it to the consumer
216
- verify (serverCallStreamObserver , timeout (50 ).times (1 )).setOnCancelHandler (any ());
218
+ verify (serverCallStreamObserver , timeout (testTimeout ).times (1 )).setOnCancelHandler (any ());
217
219
218
220
// Confirm the mediator unsubscribed the consumer
219
221
assertFalse (streamMediator .isSubscribed (testConsumerBlockItemObserver ));
@@ -245,7 +247,7 @@ public void testOnCloseSubscriptionHandling() throws IOException {
245
247
testConsumerBlockItemObserver .getOnClose ().run ();
246
248
247
249
// Verify the event made it to the consumer
248
- verify (serverCallStreamObserver , timeout (50 ).times (1 )).setOnCancelHandler (any ());
250
+ verify (serverCallStreamObserver , timeout (testTimeout ).times (1 )).setOnCancelHandler (any ());
249
251
250
252
// Confirm the mediator unsubscribed the consumer
251
253
assertFalse (streamMediator .isSubscribed (testConsumerBlockItemObserver ));
@@ -274,7 +276,7 @@ public void testMediatorBlocksPublishAfterException() throws IOException, Interr
274
276
275
277
// Confirm the BlockPersistenceHandler write method was only called
276
278
// once despite the second block being published.
277
- verify (blockWriter , timeout (50 ).times (1 )).write (firstBlockItem );
279
+ verify (blockWriter , timeout (testTimeout ).times (1 )).write (firstBlockItem );
278
280
}
279
281
}
280
282
0 commit comments