-
-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/DiUS/pact-jvm into featur…
…e/publish-to-broker
- Loading branch information
Showing
75 changed files
with
1,298 additions
and
396 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ subprojects { | |
return | ||
} | ||
|
||
version = '4.1.7' | ||
version = '4.1.8' | ||
|
||
buildscript { | ||
repositories { | ||
|
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
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
69 changes: 69 additions & 0 deletions
69
consumer/junit5/src/test/java/au/com/dius/pact/consumer/junit5/Issue1176Test.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,69 @@ | ||
package au.com.dius.pact.consumer.junit5; | ||
|
||
import au.com.dius.pact.consumer.MockServer; | ||
import au.com.dius.pact.consumer.dsl.PactDslWithProvider; | ||
import au.com.dius.pact.core.model.RequestResponsePact; | ||
import au.com.dius.pact.core.model.annotations.Pact; | ||
import com.jayway.restassured.builder.RequestSpecBuilder; | ||
import com.jayway.restassured.filter.log.RequestLoggingFilter; | ||
import com.jayway.restassured.filter.log.ResponseLoggingFilter; | ||
import com.jayway.restassured.http.ContentType; | ||
import com.jayway.restassured.response.Response; | ||
import com.jayway.restassured.specification.RequestSpecification; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
|
||
import java.util.Collections; | ||
import java.util.Map; | ||
|
||
import static com.jayway.restassured.RestAssured.given; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
@ExtendWith({PactConsumerTestExt.class}) | ||
public class Issue1176Test { | ||
private static final String CONFIG_URL = "/config"; | ||
|
||
@BeforeEach | ||
public void setUp(MockServer mockServer) { | ||
assertNotNull(mockServer); | ||
} | ||
|
||
@Pact(provider = "config-service", consumer = "test-integration") | ||
public RequestResponsePact validCredentials(PactDslWithProvider builder) { | ||
Map<String, String> headers = Collections.singletonMap("Content-Type", ContentType.TEXT.toString()); | ||
|
||
RequestResponsePact pact = builder | ||
.uponReceiving("valid configuration") | ||
.path(CONFIG_URL) | ||
.method("GET") | ||
.headers(headers) | ||
.body("text") | ||
.willRespondWith() | ||
.status(200) | ||
.body("{\"data\":\"\", \"status\":\"success\"}") | ||
.toPact(); | ||
|
||
return pact; | ||
} | ||
|
||
@Test | ||
@PactTestFor(hostInterface = "localhost", pactMethod = "validCredentials", port = "7001") | ||
public void runTest(MockServer mockServer) { | ||
RequestLoggingFilter requestLoggingFilter = new RequestLoggingFilter(); | ||
ResponseLoggingFilter responseLoggingFilter = new ResponseLoggingFilter(); | ||
|
||
RequestSpecification requestSpec = new RequestSpecBuilder() | ||
.setContentType(ContentType.TEXT) | ||
.setPort(mockServer.getPort()) | ||
.setBasePath(CONFIG_URL) | ||
.addFilter(requestLoggingFilter) | ||
.addFilter(responseLoggingFilter) | ||
.setBody("text") | ||
.build(); | ||
|
||
Response response = given().spec(requestSpec).get(); | ||
assertEquals("success", response.body().jsonPath().get("status")); | ||
} | ||
} |
Oops, something went wrong.