diff --git a/samples/standalone/restdocs/http-client/pom.xml b/samples/standalone/restdocs/http-client/pom.xml
index c4dc7be630..eda86e1cdd 100644
--- a/samples/standalone/restdocs/http-client/pom.xml
+++ b/samples/standalone/restdocs/http-client/pom.xml
@@ -7,8 +7,8 @@
http-client-restdocs
0.0.1-SNAPSHOT
- Spring Cloud Contract Verifier Http Client Sample
- Spring Cloud Contract Verifier Http Client Sample
+ Spring Cloud Contract RestDocs Http Client Sample
+ Spring Cloud Contract RestDocs Http Client Sample
org.springframework.boot
diff --git a/samples/standalone/restdocs/http-server/build.gradle b/samples/standalone/restdocs/http-server/build.gradle
index 6279c4264c..7927eeb324 100644
--- a/samples/standalone/restdocs/http-server/build.gradle
+++ b/samples/standalone/restdocs/http-server/build.gradle
@@ -11,7 +11,6 @@ buildscript {
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:1.4.0.BUILD-SNAPSHOT"
- classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:${findProperty('verifierVersion') ?: verifierVersion}"
}
}
@@ -39,10 +38,6 @@ dependencyManagement {
}
}
-contracts {
- baseClassForTests = 'com.example.fraud.MvcTest'
-}
-
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-actuator")
diff --git a/samples/standalone/restdocs/http-server/pom.xml b/samples/standalone/restdocs/http-server/pom.xml
index 82310d4839..55882b6c18 100644
--- a/samples/standalone/restdocs/http-server/pom.xml
+++ b/samples/standalone/restdocs/http-server/pom.xml
@@ -7,8 +7,8 @@
http-server-restdocs
0.0.1-SNAPSHOT
- Spring Cloud Contract Verifier Http Server Sample
- Spring Cloud Contract Verifier Http Server Sample
+ Spring Cloud Contract RestDocs Http Server Sample
+ Spring Cloud RestDocs Verifier Http Server Sample
org.springframework.boot
@@ -49,6 +49,11 @@
spring-cloud-contract-wiremock
test
+
+ com.google.code.gson
+ gson
+ test
+
diff --git a/samples/standalone/restdocs/http-server/src/test/java/com/example/fraud/StubGeneratorTests.java b/samples/standalone/restdocs/http-server/src/test/java/com/example/fraud/StubGeneratorTests.java
index 82be6a0462..8e8a1462bf 100644
--- a/samples/standalone/restdocs/http-server/src/test/java/com/example/fraud/StubGeneratorTests.java
+++ b/samples/standalone/restdocs/http-server/src/test/java/com/example/fraud/StubGeneratorTests.java
@@ -1,10 +1,8 @@
package com.example.fraud;
-import static org.springframework.cloud.contract.wiremock.restdocs.WireMockRestDocs.verify;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
-
import java.math.BigDecimal;
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -20,6 +18,10 @@ import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import com.example.fraud.model.FraudCheck;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import static org.springframework.cloud.contract.wiremock.restdocs.WireMockRestDocs.verify;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
@@ -34,6 +36,13 @@ public class StubGeneratorTests {
private JacksonTester json;
+ @Before
+ public void setup() {
+ ObjectMapper objectMappper = new ObjectMapper();
+ // Possibly configure the mapper
+ JacksonTester.initFields(this, objectMappper);
+ }
+
@Test
public void shouldMarkClientAsFraud() throws Exception {
FraudCheck fraudCheck = new FraudCheck();
diff --git a/samples/standalone/restdocs/http-server/src/test/resources/contracts/shouldMarkClientAsFraud.groovy b/samples/standalone/restdocs/http-server/src/test/resources/contracts/shouldMarkClientAsFraud.groovy
deleted file mode 100644
index c42d691b82..0000000000
--- a/samples/standalone/restdocs/http-server/src/test/resources/contracts/shouldMarkClientAsFraud.groovy
+++ /dev/null
@@ -1,31 +0,0 @@
-package contracts
-
-org.springframework.cloud.contract.spec.Contract.make {
- request {
- method 'PUT'
- url '/fraudcheck'
- body("""
- {
- "clientId":"${value(consumer(regex('[0-9]{10}')))}",
- "loanAmount":99999}
- """
- )
- headers {
- header('Content-Type', 'application/vnd.fraud.v1+json')
- }
- }
- response {
- status 200
- body( """{
- "fraudCheckStatus": "FRAUD",
- "rejectionReason": "Amount too high"
- }""")
- headers {
- header('Content-Type': value(
- producer(regex('application/vnd.fraud.v1.json.*')),
- consumer('application/vnd.fraud.v1+json'))
- )
- }
- }
-
-}
diff --git a/samples/standalone/restdocs/http-server/src/test/resources/contracts/shouldMarkClientAsNotFraud.groovy b/samples/standalone/restdocs/http-server/src/test/resources/contracts/shouldMarkClientAsNotFraud.groovy
deleted file mode 100644
index 2b3bea7222..0000000000
--- a/samples/standalone/restdocs/http-server/src/test/resources/contracts/shouldMarkClientAsNotFraud.groovy
+++ /dev/null
@@ -1,33 +0,0 @@
-package contracts
-
-org.springframework.cloud.contract.spec.Contract.make {
- request {
- method 'PUT'
- url '/fraudcheck'
- body("""
- {
- "clientId":"${value(consumer(regex('[0-9]{10}')), producer('1234567890'))}",
- "loanAmount":123.123
- }
- """
- )
- headers {
- header('Content-Type', 'application/vnd.fraud.v1+json')
- }
-
- }
- response {
- status 200
- body(
- fraudCheckStatus: "OK",
- rejectionReason: $(consumer(null), producer(execute('assertThatRejectionReasonIsNull($it)')))
- )
- headers {
- header('Content-Type': value(
- producer(regex('application/vnd.fraud.v1.json.*')),
- consumer('application/vnd.fraud.v1+json'))
- )
- }
- }
-
-}