Skip to content

Commit 77fccb2

Browse files
authored
Fixed testSignalExternalWorkflowImmediateCancellation test (#109)
1 parent 69905fb commit 77fccb2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/test/java/com/uber/cadence/workflow/WorkflowTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,8 +791,10 @@ public void testSignalUntyped() {
791791
WorkflowExecution execution = client.start();
792792
assertEquals("initial", client.query("QueryableWorkflow::getState", String.class));
793793
client.signal("testSignal", "Hello ");
794+
while(!"Hello ".equals(client.query("QueryableWorkflow::getState", String.class))) {}
794795
assertEquals("Hello ", client.query("QueryableWorkflow::getState", String.class));
795796
client.signal("testSignal", "World!");
797+
while(!"World!".equals(client.query("QueryableWorkflow::getState", String.class))) {}
796798
assertEquals("World!", client.query("QueryableWorkflow::getState", String.class));
797799
assertEquals("Hello World!", workflowClient.newUntypedWorkflowStub(execution).getResult(String.class));
798800
}
@@ -1090,7 +1092,12 @@ public void testSignalExternalWorkflowImmediateCancellation() {
10901092
options.setTaskStartToCloseTimeout(Duration.ofSeconds(2));
10911093
options.setTaskList(taskList);
10921094
TestWorkflow1 client = workflowClient.newWorkflowStub(TestWorkflow1.class, options.build());
1093-
assertEquals("result", client.execute());
1095+
try {
1096+
client.execute();
1097+
fail("unreachable");
1098+
} catch (WorkflowFailureException e) {
1099+
assertTrue(e.getCause() instanceof CancellationException);
1100+
}
10941101
}
10951102

10961103
public static class TestChildWorkflowAsyncRetryWorkflow implements TestWorkflow1 {

0 commit comments

Comments
 (0)