21
21
import com .mongodb .internal .TimeoutSettings ;
22
22
import com .mongodb .internal .async .function .LoopState .AttachmentKey ;
23
23
import com .mongodb .internal .operation .retry .AttachmentKeys ;
24
- import org .junit .Ignore ;
25
24
import org .junit .jupiter .api .Assertions ;
26
25
import org .junit .jupiter .api .DisplayName ;
27
26
import org .junit .jupiter .api .Test ;
@@ -331,14 +330,12 @@ void advanceOrThrowPredicateThrowsAfterFirstAttempt(final TimeoutContext timeout
331
330
}));
332
331
}
333
332
334
- @ Ignore // TODO (CSOT) update this
335
333
@ Test
336
334
void advanceOrThrowPredicateThrowsTimeoutAfterFirstAttempt () {
337
335
RetryState retryState = new RetryState (TIMEOUT_CONTEXT_EXPIRED_GLOBAL_TIMEOUT );
338
336
RuntimeException predicateException = new RuntimeException () {
339
337
};
340
- RuntimeException attemptException = new RuntimeException () {
341
- };
338
+ RuntimeException attemptException = new MongoOperationTimeoutException (EXPECTED_TIMEOUT_MESSAGE );
342
339
MongoOperationTimeoutException mongoOperationTimeoutException = assertThrows (MongoOperationTimeoutException .class ,
343
340
() -> retryState .advanceOrThrow (attemptException , (e1 , e2 ) -> e2 , (rs , e ) -> {
344
341
assertTrue (rs .isFirstAttempt ());
@@ -347,7 +344,7 @@ void advanceOrThrowPredicateThrowsTimeoutAfterFirstAttempt() {
347
344
}));
348
345
349
346
assertEquals (EXPECTED_TIMEOUT_MESSAGE , mongoOperationTimeoutException .getMessage ());
350
- assertEquals ( attemptException , mongoOperationTimeoutException .getCause ());
347
+ assertNull ( mongoOperationTimeoutException .getCause ());
351
348
}
352
349
353
350
@ ParameterizedTest
@@ -417,14 +414,13 @@ void advanceOrThrowTransformAfterFirstAttempt(final TimeoutContext timeoutContex
417
414
}));
418
415
}
419
416
420
- @ Ignore // TODO (CSOT) update this
421
417
@ Test
422
418
void advanceOrThrowTransformThrowsTimeoutExceptionAfterFirstAttempt () {
423
419
RetryState retryState = new RetryState (TIMEOUT_CONTEXT_EXPIRED_GLOBAL_TIMEOUT );
424
- RuntimeException attemptException = new RuntimeException () {
425
- } ;
426
- RuntimeException transformerResult = new RuntimeException () {
427
- };
420
+
421
+ RuntimeException attemptException = new MongoOperationTimeoutException ( EXPECTED_TIMEOUT_MESSAGE ) ;
422
+ RuntimeException transformerResult = new RuntimeException ();
423
+
428
424
MongoOperationTimeoutException mongoOperationTimeoutException =
429
425
assertThrows (MongoOperationTimeoutException .class , () -> retryState .advanceOrThrow (attemptException ,
430
426
(e1 , e2 ) -> {
@@ -439,7 +435,6 @@ void advanceOrThrowTransformThrowsTimeoutExceptionAfterFirstAttempt() {
439
435
440
436
assertEquals (EXPECTED_TIMEOUT_MESSAGE , mongoOperationTimeoutException .getMessage ());
441
437
assertEquals (transformerResult , mongoOperationTimeoutException .getCause ());
442
-
443
438
}
444
439
445
440
@ ParameterizedTest
0 commit comments