Skip to content

Commit

Permalink
Update pact tests to use the v4 pact datatype (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael1142 authored Aug 13, 2024
1 parent e8cc39f commit b6e82f4
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import au.com.dius.pact.consumer.dsl.PactDslWithProvider;
import au.com.dius.pact.consumer.junit5.PactConsumerTestExt;
import au.com.dius.pact.consumer.junit5.PactTestFor;
import au.com.dius.pact.core.model.RequestResponsePact;
import au.com.dius.pact.core.model.V4Pact;
import au.com.dius.pact.core.model.annotations.Pact;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand Down Expand Up @@ -52,7 +52,7 @@ public void setUpTest() {
}

@Pact(consumer = "s2s_auth_client")
public RequestResponsePact executeLease(PactDslWithProvider builder) throws JsonProcessingException {
public V4Pact executeLease(PactDslWithProvider builder) throws JsonProcessingException {

return builder.given("microservice with valid credentials")
.uponReceiving("a request for a token")
Expand All @@ -63,11 +63,11 @@ public RequestResponsePact executeLease(PactDslWithProvider builder) throws Json
.headers(Map.of(HttpHeaders.CONTENT_TYPE, "text/plain"))
.status(HttpStatus.OK.value())
.body(PactDslRootValue.stringType(SOME_MICRO_SERVICE_TOKEN))
.toPact();
.toPact(V4Pact.class);
}

@Pact(consumer = "s2s_auth_client")
public RequestResponsePact executeDetails(PactDslWithProvider builder) throws JsonProcessingException {
public V4Pact executeDetails(PactDslWithProvider builder) throws JsonProcessingException {

return builder.given("microservice with valid token")
.uponReceiving("a request to validate details")
Expand All @@ -78,7 +78,7 @@ public RequestResponsePact executeDetails(PactDslWithProvider builder) throws Js
.headers(Map.of(HttpHeaders.CONTENT_TYPE, "text/plain"))
.status(HttpStatus.OK.value())
.body(PactDslRootValue.stringType(SOME_MICRO_SERVICE_NAME))
.toPact();
.toPact(V4Pact.class);
}

@Test
Expand Down

0 comments on commit b6e82f4

Please sign in to comment.