Wiremock stubs with cookies + some tests
This commit is contained in:
committed by
Alex Xandra Albert Sim
parent
e7996e846e
commit
a0641790a9
@@ -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 {
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user