@@ -304,6 +304,7 @@ public void callChildWorkflowWithOptions() {
304
304
305
305
assertEquals (retryPolicy .getMaxNumberOfAttempts (), taskOptions .getRetryPolicy ().getMaxNumberOfAttempts ());
306
306
assertEquals (retryPolicy .getFirstRetryInterval (), taskOptions .getRetryPolicy ().getFirstRetryInterval ());
307
+ assertEquals (Duration .ZERO , taskOptions .getRetryPolicy ().getRetryTimeout ());
307
308
}
308
309
309
310
@ Test
@@ -327,4 +328,52 @@ public void newUuidTestNoImplementationExceptionTest() {
327
328
String expectedMessage = "No implementation found." ;
328
329
assertEquals (expectedMessage , runtimeException .getMessage ());
329
330
}
331
+
332
+ @ Test
333
+ public void workflowRetryPolicyRetryTimeoutValueShouldHaveRightValueWhenBeingSet () {
334
+ String expectedName = "TestActivity" ;
335
+ String expectedInput = "TestInput" ;
336
+ String expectedInstanceId = "TestInstanceId" ;
337
+ WorkflowTaskRetryPolicy retryPolicy = WorkflowTaskRetryPolicy .newBuilder ()
338
+ .setMaxNumberOfAttempts (1 )
339
+ .setFirstRetryInterval (Duration .ofSeconds (10 ))
340
+ .setRetryTimeout (Duration .ofSeconds (10 ))
341
+ .build ();
342
+ WorkflowTaskOptions executionOptions = new WorkflowTaskOptions (retryPolicy );
343
+ ArgumentCaptor <TaskOptions > captor = ArgumentCaptor .forClass (TaskOptions .class );
344
+
345
+ context .callChildWorkflow (expectedName , expectedInput , expectedInstanceId , executionOptions , String .class );
346
+
347
+ verify (mockInnerContext , times (1 ))
348
+ .callSubOrchestrator (
349
+ eq (expectedName ),
350
+ eq (expectedInput ),
351
+ eq (expectedInstanceId ),
352
+ captor .capture (),
353
+ eq (String .class )
354
+ );
355
+
356
+ TaskOptions taskOptions = captor .getValue ();
357
+
358
+ assertEquals (Duration .ofSeconds (10 ), taskOptions .getRetryPolicy ().getRetryTimeout ());
359
+ }
360
+
361
+ @ Test
362
+ public void workflowRetryPolicyRetryThrowIllegalArgumentWhenNullRetryTimeoutIsSet () {
363
+ assertThrows (IllegalArgumentException .class , () ->
364
+ WorkflowTaskRetryPolicy .newBuilder ()
365
+ .setMaxNumberOfAttempts (1 )
366
+ .setFirstRetryInterval (Duration .ofSeconds (10 ))
367
+ .setRetryTimeout (null )
368
+ .build ());
369
+ }
370
+
371
+ @ Test
372
+ public void workflowRetryPolicyRetryThrowIllegalArgumentWhenRetryTimeoutIsLessThanMaxRetryInterval () {
373
+ assertThrows (IllegalArgumentException .class , () -> WorkflowTaskRetryPolicy .newBuilder ()
374
+ .setMaxNumberOfAttempts (1 )
375
+ .setFirstRetryInterval (Duration .ofSeconds (10 ))
376
+ .setRetryTimeout (Duration .ofSeconds (9 ))
377
+ .build ());
378
+ }
330
379
}
0 commit comments