@@ -657,4 +657,47 @@ public void testAuthOAuth(String workflowLocation) {
657
657
assertEquals ("${ $SECRETS.clientid }" , auth .getOauth ().getClientId ());
658
658
assertEquals ("${ $SECRETS.clientsecret }" , auth .getOauth ().getClientSecret ());
659
659
}
660
+
661
+ @ ParameterizedTest
662
+ @ ValueSource (strings = {"/features/actionssleep.json" , "/features/actionssleep.yml" })
663
+ public void testActionsSleep (String workflowLocation ) {
664
+ Workflow workflow = Workflow .fromSource (WorkflowTestUtils .readWorkflowFile (workflowLocation ));
665
+
666
+ assertNotNull (workflow );
667
+ assertNotNull (workflow .getId ());
668
+ assertNotNull (workflow .getName ());
669
+ assertNotNull (workflow .getStates ());
670
+
671
+ assertNotNull (workflow .getStates ());
672
+ assertEquals (1 , workflow .getStates ().size ());
673
+
674
+ State state = workflow .getStates ().get (0 );
675
+ assertTrue (state instanceof OperationState );
676
+
677
+ OperationState operationState = (OperationState ) workflow .getStates ().get (0 );
678
+ assertNotNull (operationState .getActions ());
679
+ assertEquals (2 , operationState .getActions ().size ());
680
+
681
+ Action action1 = operationState .getActions ().get (0 );
682
+ assertNotNull (action1 );
683
+ assertNotNull (action1 .getFunctionRef ());
684
+ assertNotNull (action1 .getSleep ());
685
+ assertEquals ("PT5S" , action1 .getSleep ().getBefore ());
686
+ assertEquals ("PT10S" , action1 .getSleep ().getAfter ());
687
+ FunctionRef functionRef1 = action1 .getFunctionRef ();
688
+ assertEquals ("creditCheckFunction" , functionRef1 .getRefName ());
689
+ assertNull (functionRef1 .getArguments ());
690
+
691
+ Action action2 = operationState .getActions ().get (1 );
692
+ assertNotNull (action2 );
693
+ assertNotNull (action2 .getFunctionRef ());
694
+ assertNotNull (action2 .getSleep ());
695
+ assertEquals ("PT5S" , action2 .getSleep ().getBefore ());
696
+ assertEquals ("PT10S" , action2 .getSleep ().getAfter ());
697
+ FunctionRef functionRef2 = action2 .getFunctionRef ();
698
+ assertEquals ("sendRejectionEmailFunction" , functionRef2 .getRefName ());
699
+ assertEquals (1 , functionRef2 .getArguments ().size ());
700
+ assertEquals ("${ .customer }" , functionRef2 .getArguments ().get ("applicant" ).asText ());
701
+
702
+ }
660
703
}
0 commit comments