0

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.

KnechtRootrecht
  • 493
  • 1
  • 4
  • 18

2 Answers2

1

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

Irwan Hendra
  • 150
  • 10
  • Thank you for your answer. Can you provide a more specific example? I think I don't get it. Eclipse wants me to "Add some tests to this class.", when I use this example. – KnechtRootrecht Jul 25 '17 at 14:43
0

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
  }
KnechtRootrecht
  • 493
  • 1
  • 4
  • 18