title: Pact provider tests broken: pactVerificationTestTemplate » PreconditionViolation
body: <p>I'm quite new to CDC testing and only make my first steps. I've deployed the Pact-Broker (docker-compose), running at localhost:80. The consumer sends the generated pacts successfully to the broker, but it seems that the provider can't get a valid contract (but this is only the assumption).</p>
  
  <p>I'm using spring-boot, maven, jUnit5. Application tests are running on Ubuntu. 
  <em>Using PactFolder with the consumer-generated pact-contract in local directory results in successful tests.</em> </p>
  
  <p>When I'm switching to @PactBroker annotation, the provider is able to connect to the broker and it receives the following response (I got it from debug logs):</p>
  
  <pre><code>{"_links":
      {"self":{
          "href":"http://localhost/pacts/provider/provider-    name/latest","title":"Latest pact versions for the provider provider-name"},
      "pb:provider":{"href":"http://localhost/pacticipants/provider-name",
          "name":"provider-name"},
      "pb:pacts":[
          {"href":"http://localhost/pacts/provider/provider-name/consumer/consumer-name/version/1.0.0",
          "title":"Pact between consumer-name (v1.0.0) and provider-name",
          "name":"consumer-name"} 
       ],
      "provider":{
          "href":"http://localhost/pacticipants/provider-name",
          "title":"provider-name",
          "name":"DEPRECATED - please use the pb:provider relation"
       },
      "pacts":[
              {"href":"http://localhost/pacts/provider/provider-name/consumer/consumer-name/version/1.0.0",
              "title":"DEPRECATED - please use the pb:pacts relation. Pact between consumer-name (v1.0.0) and provider-name",
              "name":"consumer-name"
              }
          ]
      }
  }
  </code></pre>
  
  <p>And the test run results in the following: </p>
  
  <pre><code>[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 9.758 s 
  FAILURE! - in com.tis.payment.mapper.PaymentMapperApplicationTests
  [ERROR] pactVerificationTestTemplate{PactVerificationContext}  
  Time elapsed: 9.752 s  
  ERROR!
  org.junit.platform.commons.util.PreconditionViolationException: 
  No supporting TestTemplateInvocationContextProvider provided an invocation context
  [INFO] 
  [INFO] Results:
  [INFO] 
  [ERROR] Errors: 
  [ERROR]   PaymentMapperApplicationTests.pactVerificationTestTemplate » PreconditionViolation
  [INFO] 
  [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
  </code></pre>
  
  <p>As using the local pact file makes tests green, I suppose that the reason is not in the code of my test class, though if it could be helpful, I provide it here: </p>
  
  <pre><code>@ExtendWith(SpringExtension.class)
  @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT,
          properties = "server.port=8082")
  @Provider("provider-name")
  @PactBroker(host = "localhost", port = "80", tags="latest")
  //@PactFolder("target/pacts") # uncomment to use local pact files
  public class ApplicationTests {
  
      @MockBean
      private ProviderServiceClient providerServiceClient;
  
      @BeforeEach
      void setupTestTarget(PactVerificationContext context) {
          context.setTarget(new HttpTestTarget("localhost", 8082, "/"));
      }
  
      @TestTemplate
      @ExtendWith(PactVerificationInvocationContextProvider.class)
      void pactVerificationTestTemplate(PactVerificationContext context) {
          context.verifyInteraction();
      }
  
      @State({"valid payment file"})
      public void toValid() {
          ServiceResponse response = new ServiceResponse();
          response.setBatchId("test");
          response.setId(1L);
          when(providerServiceClient.save(any())).thenReturn(response);
      }
  
      @State({"invalid payment file"})
      public void toInvalid() {
      }
  }
  </code></pre>
  
  <p><strong><em>As using local pact files is not an option, I really wonder how to fix the error and will be grateful for any helpful comments</em></strong>.</p>
  
  <p>maven pact dependencies:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;au.com.dius&lt;/groupId&gt;
      &lt;artifactId&gt;pact-jvm-model&lt;/artifactId&gt;
      &lt;version&gt;3.5.22&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;au.com.dius&lt;/groupId&gt;
      &lt;artifactId&gt;pact-jvm-provider-junit5_2.12&lt;/artifactId&gt;
      &lt;version&gt;3.5.22&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;au.com.dius&lt;/groupId&gt;
      &lt;artifactId&gt;pact-jvm-consumer-junit5_2.12&lt;/artifactId&gt;
      &lt;version&gt;3.5.22&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>Plugin for maven to publish the consumer's pacts: </p>
  
  <pre><code>&lt;plugin&gt;
      &lt;groupId&gt;au.com.dius&lt;/groupId&gt;
      &lt;artifactId&gt;pact-jvm-provider-maven_2.12&lt;/artifactId&gt;
      &lt;version&gt;3.5.22&lt;/version&gt;
      &lt;configuration&gt;
          &lt;pactBrokerUrl&gt;http://localhost:80&lt;/pactBrokerUrl&gt;
          &lt;trimSnapshot&gt;true&lt;/trimSnapshot&gt;
          &lt;!-- Defaults to false --&gt;
      &lt;/configuration&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>the pact-provider docker-compose.yml:</p>
  
  <pre><code>version: '2'
      services:
          postgres:
            image: postgres
            restart: always
            # healthcheck:
              # test: psql postgres --command "select 1" -U postgres
            ports:
              - "5432:5432"
            environment:
              POSTGRES_USER: postgres
              POSTGRES_PASSWORD: password
              POSTGRES_DB: postgres
          broker_app:
            image: dius/pact-broker
            depends_on: 
              - postgres
            ports:
              - "80:80"
            links:
              - postgres
            environment:
              PACT_BROKER_DATABASE_USERNAME: postgres
              PACT_BROKER_DATABASE_PASSWORD: password
              PACT_BROKER_DATABASE_HOST: postgres
              PACT_BROKER_DATABASE_NAME: postgres
  </code></pre>