Skip to content
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

DateConsumerTest.java needs to be updated #106

Open
anchit-h opened this issue Apr 30, 2021 · 0 comments
Open

DateConsumerTest.java needs to be updated #106

anchit-h opened this issue Apr 30, 2021 · 0 comments

Comments

@anchit-h
Copy link

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));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant