-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: strip queryparams from path and get them handled separately (#5)
- Loading branch information
Showing
4 changed files
with
145 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
wiremock-pact-lib/src/test/java/se/bjurr/wiremockpact/wiremockpact/test/QueryParamsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package se.bjurr.wiremockpact.wiremockpact.test; | ||
|
||
import com.github.tomakehurst.wiremock.client.WireMock; | ||
import io.restassured.RestAssured; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import se.bjurr.wiremockpact.wiremockpact.testutils.BaseTest; | ||
|
||
public class QueryParamsTest extends BaseTest { | ||
|
||
@BeforeEach | ||
public void beforeEach() { | ||
WireMock.reset(); | ||
WireMock.stubFor(WireMock.any(WireMock.anyUrl()).willReturn(WireMock.ok())); | ||
} | ||
|
||
@Test | ||
public void testThatSingleHeaderIsRecorded() { | ||
RestAssured.given() | ||
.queryParam("foo", "bar") | ||
.log() | ||
.all() | ||
.when() | ||
.put("/therequest") | ||
.then() | ||
.statusCode(200); | ||
|
||
this.assertPactEquals( | ||
""" | ||
{ | ||
"consumer": { | ||
"name": "this-is-me" | ||
}, | ||
"interactions": [ | ||
{ | ||
"description": "PUT /therequest?foo=bar -> 200", | ||
"key": "a08c5440", | ||
"pending": false, | ||
"request": { | ||
"body": { | ||
"content": "" | ||
}, | ||
"headers": { | ||
"Accept": [ | ||
"*/*" | ||
], | ||
"Accept-Encoding": [ | ||
"gzip,deflate" | ||
], | ||
"Content-Length": [ | ||
"0" | ||
] | ||
}, | ||
"method": "PUT", | ||
"path": "/therequest", | ||
"query": { | ||
"foo": [ | ||
"bar" | ||
] | ||
} | ||
}, | ||
"response": { | ||
"body": { | ||
"content": "" | ||
}, | ||
"status": 200 | ||
}, | ||
"type": "Synchronous/HTTP" | ||
} | ||
], | ||
"metadata": { | ||
"pact-jvm": { | ||
"version": "4.6.9" | ||
}, | ||
"pactSpecification": { | ||
"version": "4.0" | ||
} | ||
}, | ||
"provider": { | ||
"name": "this-is-you" | ||
} | ||
} | ||
"""); | ||
} | ||
} |