I am trying to migrate my pact consumer tests from jUnit4 to jUnit5.
I've run across a problem with @DefaultRequestValues annotation, which is missing in pact-jvm-consumer-junit5.
In jUnit4 I was using it as follows:
@DefaultRequestValues
def defaultRequestValues(request: PactDslRequestWithoutPath): Unit = {
request
.method("POST")
.headers(
HttpHeaders.CONTENT_TYPE, APPLICATION_JSON.getMimeType,
HttpHeaders.AUTHORIZATION, s"$TokenType $ValidToken",
)
}
What is the recommended equivalent in pact-jvm-consumer-junit5?
I used following code:
I call
setDefaultRequestValuesas a first statement of each@Pactannotated method.I arrived at this solution by looking at jUnit4 implelentation in BaseProviderRule