I've got the following two lines from this example: https://github.com/DiUS/pact-jvm/tree/master/pact-jvm-provider
consumer.setPactFile(new File("target/pacts/ping_client-ping_service.json"));
testConsumerPact = (Pact) PactReader.loadPact(consumer.getPactFile());
They result in the message:
The method getPactFile() from the type ConsumerInfo is deprecated
What to use instead?
Thanks for your help in advance.
If you are looking to verify a PACT as provider using JUnit, you can follow this one instead:
https://github.com/DiUS/pact-jvm/tree/master/pact-jvm-provider-junit
A look into sourcecode revealed the answer:
/**
* Sets the Pact File for the consumer
* @param file Pact file, either as a string or a PactSource
* @deprecated Use setPactSource instead
*/
@Deprecated
void setPactFile(def file) {
if (file instanceof PactSource) {
pactSource = file
} else {
pactSource = new FileSource(file as File)
}
}
/**
* Returns the Pact file for the consumer
* @deprecated Use getPactSource instead
*/
@Deprecated
def getPactFile() {
pactSource
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.