I am using spring cloud contract for messages as described in
Everything works as described in the documentation.
I have one situation where my triggeredBy method raises two messages on same channel (e.g. SMS to be sent to two different parties) and I am not able to assert both the messages correctly. The messages are received in random order and sometimes the test cases pass and sometimes it fails.
I need a way to assert both the messages correctly.
The OutputMessage
has also the assertThat
method (https://github.com/spring-cloud/spring-cloud-contract/blob/v1.2.1.RELEASE/spring-cloud-contract-spec/src/main/groovy/org/springframework/cloud/contract/spec/internal/OutputMessage.groovy#L35), it's described here (https://cloud.spring.io/spring-cloud-static/spring-cloud-contract/1.2.1.RELEASE/single/spring-cloud-contract.html#contract-dsl-common). You can assert also the other message there. You can also use that assertion in the input part to know exactly which message was sent and then you can send the missing one too.