Removed unnecessary duplicated call to rest doc's document method; fixes gh-816

This commit is contained in:
Marcin Grzejszczak
2019-01-15 17:36:25 +01:00
parent 122ae70851
commit 4a127e7785
3 changed files with 9 additions and 9 deletions

View File

@@ -16,6 +16,7 @@ import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWeb
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.json.JacksonTester;
import org.springframework.http.MediaType;
import org.springframework.restdocs.webtestclient.WebTestClientRestDocumentation;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.reactive.server.WebTestClient;
import org.springframework.web.reactive.function.BodyInserters;
@@ -54,7 +55,8 @@ public class StubGeneratorTests {
.consumeWith(verify().jsonPath("$.clientId")
.jsonPath("$[?(@.loanAmount > 1000)]")
.contentType(MediaType.valueOf("application/vnd.fraud.v1+json"))
.stub("markClientAsFraud"));
.stub("markClientAsFraud"))
.consumeWith(WebTestClientRestDocumentation.document("markClientAsFraud"));
}
@Test
@@ -70,7 +72,8 @@ public class StubGeneratorTests {
.consumeWith(verify().jsonPath("$.clientId")
.jsonPath("$[?(@.loanAmount <= 1000)]")
.contentType(MediaType.valueOf("application/vnd.fraud.v1+json"))
.stub("markClientAsNotFraud"));
.stub("markClientAsNotFraud"))
.consumeWith(WebTestClientRestDocumentation.document("markClientAsNotFraud"));
}
}

View File

@@ -35,10 +35,13 @@ import com.github.tomakehurst.wiremock.http.HttpHeader;
import com.github.tomakehurst.wiremock.http.QueryParameter;
import com.github.tomakehurst.wiremock.http.Request;
import com.github.tomakehurst.wiremock.http.RequestMethod;
import wiremock.com.google.common.base.Optional;
import wiremock.org.apache.commons.codec.binary.Base64;
import wiremock.org.eclipse.jetty.server.handler.ContextHandler;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.restdocs.webtestclient.WebTestClientRestDocumentation;
import org.springframework.restdocs.webtestclient.WebTestClientRestDocumentationConfigurer;
import org.springframework.test.web.reactive.server.EntityExchangeResult;
import org.springframework.test.web.reactive.server.WebTestClient;
@@ -46,9 +49,6 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.util.ReflectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest;
import wiremock.com.google.common.base.Optional;
import wiremock.org.apache.commons.codec.binary.Base64;
import wiremock.org.eclipse.jetty.server.handler.ContextHandler;
/**
* @author Dave Syer
@@ -61,7 +61,6 @@ public class ContractExchangeHandler
@Override
public void accept(EntityExchangeResult<byte[]> result) {
configure(result);
WebTestClientRestDocumentation.document(getName()).accept(result);
}
@Override

View File

@@ -55,7 +55,6 @@ import wiremock.org.eclipse.jetty.util.MultiPartInputStreamParser;
import org.springframework.http.MediaType;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.ResultHandler;
@@ -79,7 +78,6 @@ public class ContractResultHandler extends
@Override
public void handle(MvcResult result) throws Exception {
configure(result);
MockMvcRestDocumentation.document(getName()).handle(result);
}
@Override