@@ -523,4 +523,44 @@ public void workflowRetryPolicyRetryThrowIllegalArgumentWhenRetryTimeoutIsLessTh
523523 .setRetryTimeout (Duration .ofSeconds (9 ))
524524 .build ());
525525 }
526+
527+ @ Test
528+ public void callActivityRetryPolicyMaxRetryIntervalShouldBePropagated () {
529+ String expectedName = "TestActivity" ;
530+ String expectedInput = "TestInput" ;
531+ Duration expectedMaxRetryInterval = Duration .ofSeconds (60 );
532+ WorkflowTaskRetryPolicy retryPolicy = WorkflowTaskRetryPolicy .newBuilder ()
533+ .setMaxNumberOfAttempts (5 )
534+ .setFirstRetryInterval (Duration .ofSeconds (1 ))
535+ .setMaxRetryInterval (expectedMaxRetryInterval )
536+ .build ();
537+ WorkflowTaskOptions options = new WorkflowTaskOptions (retryPolicy );
538+ ArgumentCaptor <TaskOptions > captor = ArgumentCaptor .forClass (TaskOptions .class );
539+
540+ context .callActivity (expectedName , expectedInput , options , String .class );
541+
542+ verify (mockInnerContext , times (1 ))
543+ .callActivity (eq (expectedName ), eq (expectedInput ), captor .capture (), eq (String .class ));
544+
545+ assertEquals (expectedMaxRetryInterval , captor .getValue ().getRetryPolicy ().getMaxRetryInterval ());
546+ }
547+
548+ @ Test
549+ public void callActivityRetryPolicyDefaultMaxRetryIntervalShouldBeZeroWhenNotSet () {
550+ String expectedName = "TestActivity" ;
551+ String expectedInput = "TestInput" ;
552+ WorkflowTaskRetryPolicy retryPolicy = WorkflowTaskRetryPolicy .newBuilder ()
553+ .setMaxNumberOfAttempts (5 )
554+ .setFirstRetryInterval (Duration .ofSeconds (1 ))
555+ .build ();
556+ WorkflowTaskOptions options = new WorkflowTaskOptions (retryPolicy );
557+ ArgumentCaptor <TaskOptions > captor = ArgumentCaptor .forClass (TaskOptions .class );
558+
559+ context .callActivity (expectedName , expectedInput , options , String .class );
560+
561+ verify (mockInnerContext , times (1 ))
562+ .callActivity (eq (expectedName ), eq (expectedInput ), captor .capture (), eq (String .class ));
563+
564+ assertEquals (Duration .ZERO , captor .getValue ().getRetryPolicy ().getMaxRetryInterval ());
565+ }
526566}
0 commit comments