Hi everyone! How is the better approach to create ...
# protobufs
a
Hi everyone! How is the better approach to create one contract with more than one interaction? Anyone has some example?
j
for go, i have been able to do this with separate tests that use the same consumer and provider names. each test will append it’s interaction to the json. however, if i try to AddSynchronousMessage multiple times on the same pact then the second one fails.
a
Hey @Jason Taylor! Thanks for your help! I understood that you created new tests for each interaction, but is also necessary to define the pact using
toPact()
. In this point, Im little bit confused… So should I define 2 of these :
Copy code
@Pact(consumer = "my-consumer")
V4Pact myMethod(PactBuilder builder)
or should I only add one more interaction such as:
Copy code
.expectsToReceive("my interaction", "core/interaction/synchronous-message")
.with(Map.of(
        ))).toPact().
?
j
I suspect the two methods with the same consumer name should work from Java. if your providerName and consumer names line up across tests they would each append their interaction into the same contract. if not, will need someone with explicit java experience to chime in
a
Yes @Jason Taylor it worked properly 😉 Thanks a lot.