Closed ciberkleid closed 4 years ago
Ok there are a couple of issues here.
You can't do this urlPath("/" + anyNonBlankString())
. You can either do urlPath( anyNonBlankString())
or a GString urlPath("/${nonBlank()})
The same with fromRequest
instead of "Hello " + fromRequest().path(0) + "!"
do "Hello ${fromRequest().path(0)} !"
In other words you contract should look like this
Contract contractDsl = Contract.make {
request {
method GET()
urlPath(anyNonBlankString())
}
response {
status 200
body (
"Hello ${fromRequest().path(0)}!"
)
}
}
Bug report
My BaseClass:
My contract:
Results in a compilation failure: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile (default-testCompile) on project s1p-hello-service: Compilation failure: Compilation failure: [ERROR] /Users/ciberkleid/workspace/s1p-2019/s1p-hello-service/target/generated-test-sources/contracts/spring/k8s/helloservice/contracttests/S1p_hello_clientTest.java:[29,141] illegal escape character [ERROR] /Users/ciberkleid/workspace/s1p-2019/s1p-hello-service/target/generated-test-sources/contracts/spring/k8s/helloservice/contracttests/S1p_hello_clientTest.java:[29,144] illegal escape character [ERROR] /Users/ciberkleid/workspace/s1p-2019/s1p-hello-service/target/generated-test-sources/contracts/spring/k8s/helloservice/contracttests/S1p_hello_clientTest.java:[29,147] illegal escape character [ ...
Another example, using same base class:
Contract is:
Error is: [ERROR] Failures: [ERROR] S1p_hello_clientTest.validate_shouldReturnHelloName:35 expected:<"Hello [DslProperty(clientValue:KKLXPCSMDSVMOFIQQMLO, serverValue:KKLXPCSMDSVMOFIQQMLO)]!"> but was:<"Hello [KKLXPCSMDSVMOFIQQMLO]!"> [INFO] [ERROR] Tests run: 2, Failures: 1, Errors: 0, Skipped: 0
Generated test is: