Updated code and docs
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
package com.example.fraud.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class FraudCheck {
|
||||
|
||||
@JsonProperty("client.id")
|
||||
private String clientId;
|
||||
|
||||
private BigDecimal loanAmount;
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.example.fraud.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class FraudCheckResult {
|
||||
|
||||
private FraudCheckStatus fraudCheckStatus;
|
||||
|
||||
@JsonProperty("rejection.reason")
|
||||
private String rejectionReason;
|
||||
|
||||
public FraudCheckResult() {
|
||||
|
||||
@@ -5,7 +5,7 @@ org.springframework.cloud.contract.spec.Contract.make {
|
||||
method 'PUT' // (2)
|
||||
url '/fraudcheck' // (3)
|
||||
body([ // (4)
|
||||
clientId: $(regex('[0-9]{10}')),
|
||||
"client.id": $(regex('[0-9]{10}')),
|
||||
loanAmount: 99999
|
||||
])
|
||||
headers { // (5)
|
||||
@@ -16,7 +16,7 @@ org.springframework.cloud.contract.spec.Contract.make {
|
||||
status 200 // (7)
|
||||
body([ // (8)
|
||||
fraudCheckStatus: "FRAUD",
|
||||
rejectionReason: "Amount too high"
|
||||
"rejection.reason": "Amount too high"
|
||||
])
|
||||
headers { // (9)
|
||||
contentType('application/json')
|
||||
|
||||
@@ -6,7 +6,7 @@ org.springframework.cloud.contract.spec.Contract.make {
|
||||
url '/fraudcheck'
|
||||
body("""
|
||||
{
|
||||
"clientId":"${value(consumer(regex('[0-9]{10}')), producer('1234567890'))}",
|
||||
"client.id":"${value(consumer(regex('[0-9]{10}')), producer('1234567890'))}",
|
||||
"loanAmount":123.123
|
||||
}
|
||||
"""
|
||||
@@ -20,7 +20,7 @@ org.springframework.cloud.contract.spec.Contract.make {
|
||||
status 200
|
||||
body(
|
||||
fraudCheckStatus: "OK",
|
||||
rejectionReason: $(consumer(null), producer(execute('assertThatRejectionReasonIsNull($it)')))
|
||||
"rejection.reason": $(consumer(null), producer(execute('assertThatRejectionReasonIsNull($it)')))
|
||||
)
|
||||
headers {
|
||||
contentType("application/json")
|
||||
|
||||
Reference in New Issue
Block a user