Skip to content

DateConsumerTest.java needs to be updated #106

@anchit-h

Description

@anchit-h

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions