Wiremock stubs with cookies + some tests

This commit is contained in:
Marcin Grzejszczak
2018-04-11 10:05:43 +07:00
committed by Alex Xandra Albert Sim
parent e7996e846e
commit a0641790a9
11 changed files with 71 additions and 13 deletions

View File

@@ -1,5 +1,7 @@
package com.example.fraud;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@@ -24,6 +26,12 @@ class FraudNameController {
}
return new NameResponse("Don't worry " + request.getName() + " you're not a fraud");
}
@GetMapping(value = "/frauds/name")
public String checkByName(@CookieValue("name") String value,
@CookieValue("name2") String value2) {
return value + " " + value2;
}
}
interface FraudVerifier {

View File

@@ -0,0 +1,16 @@
package contracts.fraudname
org.springframework.cloud.contract.spec.Contract.make {
request {
method GET()
url '/frauds/name'
cookies {
cookie("name", "foo")
cookie(name2: "bar")
}
}
response {
status 200
body("foo bar")
}
}