-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bug form replied and if condition #155
Fix bug form replied and if condition #155
Conversation
6e1d7b4
to
822cacf
Compare
@@ -67,6 +75,24 @@ void branching(String workflowFile, List<String> activities) throws IOException, | |||
assertThat(workflow).isExecutedWithProcessAndActivities(lastProcess(), activities); | |||
} | |||
|
|||
@Test | |||
void branching_intermediate() throws IOException, ProcessingException, InterruptedException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this test similar to the one done here?
test:
symphony-wdk/workflow-bot-app/src/test/java/com/symphony/bdk/workflow/BranchingIntegrationTest.java
Line 37 in 822cacf
arguments("/branching/if-else-if.swadl.yaml", List.of("act1", "act3")), |
swadl: https://github.com/finos/symphony-wdk/blob/822cacf4b162055880dd89fe1c1c8afb98b728e6/workflow-bot-app/src/test/resources/branching/if-else-if.swadl.yaml
We would prefer to test with an unsatisfied condition (if: variables.foo != "foo") rather than (.. == "foo") to verify the condition works. (or both cases actually)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 new test is removed, it is indeed kinda duplicated, so keep the existing test only.
engine.onEvent(form("msgId", "testForm", Collections.singletonMap("action", "create"))); | ||
return true; | ||
}); | ||
verify(messageService, timeout(5000)).send(anyString(), contains("Create")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this verifies what you think.
In line 337, we verify that we sent the form (content contains the word form).
In line 343, we want to verify that we sent a the message "Create". I don't know why Mockito.verify does not get updated, and it gets applied on the first one. So both Mockito.verify applies on the first messageService.send(..), which contains both "form" and "Create" words.
If you change the activity "resCreate" in swadl to send something else than "Create", let's say "CreateABC", and you change the test with (contains("CreateABC")), the test will fail.. One way to force Mockito.verify to apply to the new sendMessage call, is to change the to.streamId="" to a different one and replace anyString() in verify(..).
verify(messageService, timeout(5000)).send("ANOTHER_STREAM_ID", contains("SOMETHING_DIFF_FROM_CREATE"));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, i see your point, i add then the Mockito.clearInvocations(T mock) to clear the invocations on messageService mock after each verify, so that we are sure we have the right verification.
engine.onEvent(form("msgId", "testForm", Collections.singletonMap("action", "menu"))); | ||
return true; | ||
}); | ||
verify(messageService, timeout(5000)).send(anyString(), contains("Menu")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
822cacf
to
648d969
Compare
5929b52
to
c8205c0
Compare
Description
close #162
close #163
Dependencies
List the other pull requests that should be merged before/along this one.
Checklist