pact-demo | Demonstrate pact | Testing library
kandi X-RAY | pact-demo Summary
kandi X-RAY | pact-demo Summary
Demonstrate pact
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- List of greetings
- Launch the PactDemo application .
pact-demo Key Features
pact-demo Examples and Code Snippets
Community Discussions
Trending Discussions on pact-demo
QUESTION
I have a demo project here https://github.com/donalthurley/pact-demo which shows the problem I'm having.
The general problem is that I am trying to develop an API that complies to a PACT contract where the contract is using a URL path that includes a context.
The spring boot controller API maps the request without the context in the path see https://github.com/donalthurley/pact-demo/blob/master/src/main/java/com/example/demo/DemoController.java#L22
The PACT contract specifies the same request with the context 'demo' prepended to the URL path see https://github.com/donalthurley/pact-demo/blob/master/src/main/resources/demo-pact.json#L14
When pact generates the unit tests it fails in this case with a 404.
If the context is removed from the PACT contract then the generated tests succeed.
My question is this, is there any way I can tell the PACT generation to use the 'demo' context so that the generated tests will work?
This earlier answer How to set the context path in Spring Boot WebMvcTest would suggest that this is not possible but I would like to confirm that as I don't understand why this shouldn't be supported.
...ANSWER
Answered 2019-Mar-14 at 08:22In my humble opinion, you shouldn't include the context in the pact, the same way like your controller does.
I guess you are using some API-gateway, So all dealing with the context should be ended once you leave the API-gateway. In your service level the context is already irrelevant.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install pact-demo
You can use pact-demo like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the pact-demo component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page