@@ -195,7 +195,7 @@ void testWaitWithDurationExpressionMissingValue() throws IOException {
195195 // message
196196 assertThatThrownBy (() -> appl .workflowDefinition (workflow ).instance (Map .of ()).start ().join ())
197197 .hasCauseInstanceOf (IllegalArgumentException .class )
198- .hasMessageContaining ("duration ' null' " );
198+ .hasMessageContaining ("evaluated to empty or null" );
199199 }
200200
201201 // ========== Workflow Status Tests ==========
@@ -204,7 +204,7 @@ void testWaitWithDurationExpressionMissingValue() throws IOException {
204204 void testWaitSetsWorkflowStatusToWaiting () {
205205 Workflow workflow =
206206 WorkflowBuilder .workflow ("wait-status-waiting" , "test" , "0.1.0" )
207- .tasks (DSL .waitSeconds ( 2 ))
207+ .tasks (DSL .waitMillis ( 500 ))
208208 .build ();
209209
210210 WorkflowInstance instance = appl .workflowDefinition (workflow ).instance (Map .of ());
@@ -225,7 +225,7 @@ void testWaitSetsWorkflowStatusToWaiting() {
225225 void testWaitWithSuspendAndResume () {
226226 Workflow workflow =
227227 WorkflowBuilder .workflow ("wait-suspend-resume" , "test" , "0.1.0" )
228- .tasks (DSL .waitSeconds ( 2 ))
228+ .tasks (DSL .waitMillis ( 500 ))
229229 .build ();
230230
231231 WorkflowInstance instance = appl .workflowDefinition (workflow ).instance (Map .of ());
@@ -263,12 +263,9 @@ void testWaitSecondsConvenienceMethod() {
263263 .tasks (DSL .waitSeconds (1 ))
264264 .build ();
265265
266- long startTime = System .currentTimeMillis ();
267- WorkflowModel model = appl .workflowDefinition (workflow ).instance (Map .of ()).start ().join ();
268- long elapsed = System .currentTimeMillis () - startTime ;
269-
270- assertThat (model ).isNotNull ();
271- assertThat (elapsed ).isGreaterThanOrEqualTo (1000 );
266+ var waitTask = workflow .getDo ().get (0 ).getTask ().getWaitTask ();
267+ assertThat (waitTask ).isNotNull ();
268+ assertThat (waitTask .getWait ().getDurationInline ().getSeconds ()).isEqualTo (1 );
272269 }
273270
274271 @ Test
@@ -278,12 +275,9 @@ void testWaitMillisConvenienceMethod() {
278275 .tasks (DSL .waitMillis (100 ))
279276 .build ();
280277
281- long startTime = System .currentTimeMillis ();
282- WorkflowModel model = appl .workflowDefinition (workflow ).instance (Map .of ()).start ().join ();
283- long elapsed = System .currentTimeMillis () - startTime ;
284-
285- assertThat (model ).isNotNull ();
286- assertThat (elapsed ).isGreaterThanOrEqualTo (100 );
278+ var waitTask = workflow .getDo ().get (0 ).getTask ().getWaitTask ();
279+ assertThat (waitTask ).isNotNull ();
280+ assertThat (waitTask .getWait ().getDurationInline ().getMilliseconds ()).isEqualTo (100 );
287281 }
288282
289283 @ Test
@@ -293,11 +287,10 @@ void testWaitWithJavaDurationConvenienceMethod() {
293287 .tasks (DSL .wait (Duration .ofSeconds (1 ).plusMillis (500 )))
294288 .build ();
295289
296- long startTime = System .currentTimeMillis ();
297- WorkflowModel model = appl .workflowDefinition (workflow ).instance (Map .of ()).start ().join ();
298- long elapsed = System .currentTimeMillis () - startTime ;
299-
300- assertThat (model ).isNotNull ();
301- assertThat (elapsed ).isGreaterThanOrEqualTo (1500 );
290+ var waitTask = workflow .getDo ().get (0 ).getTask ().getWaitTask ();
291+ assertThat (waitTask ).isNotNull ();
292+ var inline = waitTask .getWait ().getDurationInline ();
293+ assertThat (inline .getSeconds ()).isEqualTo (1 );
294+ assertThat (inline .getMilliseconds ()).isEqualTo (500 );
302295 }
303296}
0 commit comments