WireMock RestDocs stub() method is a no-op

deprecating the method and going towards document()
fix by @dsyer

fixes gh-1092
This commit is contained in:
Marcin Grzejszczak
2019-11-05 14:03:22 +01:00
parent 4e375b99e1
commit 380d2535bd
9 changed files with 48 additions and 28 deletions

View File

@@ -22,6 +22,15 @@
<include>**/model/Fraud*.*</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}/generated-snippets/stubs</directory>
<outputDirectory>
META-INF/${project.groupId}/${project.artifactId}/${project.version}/mappings
</outputDirectory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}/snippets/stubs</directory>
<outputDirectory>

View File

@@ -36,6 +36,7 @@ import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import static org.springframework.cloud.contract.wiremock.restdocs.WireMockRestDocs.verify;
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
@RunWith(SpringRunner.class)
@@ -69,8 +70,8 @@ public class StubGeneratorTests {
.andExpect(jsonPath("$.rejectionReason").value("Amount too high"))
.andDo(verify().jsonPath("$.clientId")
.jsonPath("$[?(@.loanAmount > 1000)]")
.contentType(MediaType.valueOf("application/vnd.fraud.v1+json"))
.stub("markClientAsFraud"));
.contentType(MediaType.valueOf("application/vnd.fraud.v1+json")))
.andDo(document("markClientAsFraud"));
}
@Test
@@ -85,8 +86,8 @@ public class StubGeneratorTests {
.andExpect(jsonPath("$.rejectionReason").doesNotExist())
.andDo(verify().jsonPath("$.clientId")
.jsonPath("$[?(@.loanAmount <= 1000)]")
.contentType(MediaType.valueOf("application/vnd.fraud.v1+json"))
.stub("markClientAsNotFraud"));
.contentType(MediaType.valueOf("application/vnd.fraud.v1+json")))
.andDo(document("markClientAsNotFraud"));
}
}