JVM version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
Hi! I am new to Pact JVM and I am trying to write the test on the provider side. I am getting the error 400 as a return code instead of 200. I am using the gradle tool to test the functionality. Can someone please guide me to this issue?
I am using the correct token and the header and the content-type.
Thanks in advance.
@Provider("ABC")
@PactFolder("pacts")
public class ProviderTest {
private String token; // Declare the token variable
@BeforeEach
void before(PactVerificationContext context){
token = "1234567"
context.setTarget(new HttpsTestTarget("testing.ABC.", 443, "/..));
}
@TestTemplate
@ExtendWith(PactVerificationInvocationContextProvider.class)
void verifyPact(PactVerificationContext context, HttpRequest request) {
request.addHeader("Authorization", "Bearer " + token);
context.verifyInteraction();
}
@State("my test does not exists")
void testdoesnotexists() {
/* Set up the token as needed for this provider state */
}
}
Hi! I am new to Pact JVM and I am trying to write the test on the provider side. I am getting the error 400 as a return code instead of 200. I am using the gradle tool to test the functionality. Can someone please guide me to this issue?
I am using the correct token and the header and the content-type.
Thanks in advance.
@Provider("ABC") @PactFolder("pacts") public class ProviderTest {