You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The consumer test code as it is currently doesn't fetch the message. Instead, we need to modify it with the following:
Add @PactVerification({"provider name"}) annotation to the @test method
Remove the args to the test method
Create one more method with the following code:
public void setMessage(byte[] messageContents) {
System.out.println("Did the call come to setMessage?");
//Set the class member currentMessage value as the arg received from this function
currentMessage = messageContents;
}
This function gets called automatically by Pact during execution and it fetches the message.
Modify the @test method where all verifications are performed on the stored class variable (which will be set by Pact via setMessage)
For example, the test can have the following code:
Assert.assertNotNull(new String(currentMessage));
The text was updated successfully, but these errors were encountered:
The consumer test code as it is currently doesn't fetch the message. Instead, we need to modify it with the following:
public void setMessage(byte[] messageContents) {
System.out.println("Did the call come to setMessage?");
//Set the class member currentMessage value as the arg received from this function
currentMessage = messageContents;
}
This function gets called automatically by Pact during execution and it fetches the message.
For example, the test can have the following code:
Assert.assertNotNull(new String(currentMessage));
The text was updated successfully, but these errors were encountered: