I'm using Spring Auto REST Docs is an extension to Spring REST Docs to generate API documentation and I'm doing the set up the MockMvc as in the documentation.
As well, the same time I want generate the WireMock Stub with "http://cloud.spring.io/spring-cloud-contract/1.0.x/#_generating_stubs_using_restdocs"
I'm following this examples: https://github.com/spring-cloud-samples/spring-cloud-contract-samples
My problem is when I create a set up custom the WireMock Stub aren't created and when I use the default MockMvc configuration works but I need the custom configuration too.
@Before
public void setUp() {
this.mockMvc = MockMvcBuilders
.webAppContextSetup(context)
.alwaysDo(prepareJackson(objectMapper))
.alwaysDo(document("{class-name}/{method-name}",
preprocessRequest(), commonResponsePreprocessor()))
.apply(documentationConfiguration(restDocumentation)
.uris()
.and().snippets()
.withDefaults(curlRequest(), httpRequest(), httpResponse(),
requestFields(), responseFields(), pathParameters(),
requestParameters(), description(), methodAndPath(),
section()))
.build();
}
@Test
public void getTemplate() throws Exception {
this.mockMvc.perform(get("/")
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("result", is("success")))
.andExpect(jsonPath("version", is("0.0.1")))
.andDo(WireMockRestDocs.verify().stub("getFlapTemplate"))
.andDo(MockMvcRestDocumentation.document("getFlapTemplate", SpringCloudContractRestDocs.dslContract()));
}
Is it possible to generate the WireMock stub with a custom's configuration?