Fixed samples
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
<module>contracts</module>
|
||||
<module>restdocs</module>
|
||||
<module>dsl</module>
|
||||
<!-- <module>webclient</module> -->
|
||||
<module>webclient</module>
|
||||
</modules>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -180,7 +180,7 @@
|
||||
</pluginRepositories>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<!--<profile>
|
||||
<id>integration</id>
|
||||
<build>
|
||||
<plugins>
|
||||
@@ -198,7 +198,7 @@
|
||||
<argument>clean</argument>
|
||||
<argument>build</argument>
|
||||
<argument>publishToMavenLocal</argument>
|
||||
<!-- TODO: Remove -->
|
||||
<!– TODO: Remove –>
|
||||
<argument>-x</argument>
|
||||
<argument>test</argument>
|
||||
<argument>
|
||||
@@ -214,7 +214,7 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profile>-->
|
||||
<profile>
|
||||
<id>windows</id>
|
||||
<build>
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.json.AutoConfigureJsonTesters;
|
||||
import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs;
|
||||
@@ -32,7 +31,6 @@ 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.web.reactive.server.WebTestClient;
|
||||
import org.springframework.web.reactive.function.BodyInserters;
|
||||
|
||||
@@ -69,8 +67,7 @@ public class StubGeneratorTests {
|
||||
.jsonPath("$.rejectionReason").isEqualTo("Amount too high")
|
||||
.consumeWith(verify().jsonPath("$.clientId")
|
||||
.jsonPath("$[?(@.loanAmount > 1000)]")
|
||||
.contentType(MediaType.valueOf("application/vnd.fraud.v1+json"))
|
||||
.stub("markClientAsFraud"))
|
||||
.contentType(MediaType.valueOf("application/vnd.fraud.v1+json")))
|
||||
.consumeWith(
|
||||
WebTestClientRestDocumentation.document("markClientAsFraud"));
|
||||
}
|
||||
@@ -87,8 +84,7 @@ public class StubGeneratorTests {
|
||||
.jsonPath("$.rejectionReason").doesNotExist()
|
||||
.consumeWith(verify().jsonPath("$.clientId")
|
||||
.jsonPath("$[?(@.loanAmount <= 1000)]")
|
||||
.contentType(MediaType.valueOf("application/vnd.fraud.v1+json"))
|
||||
.stub("markClientAsNotFraud"))
|
||||
.contentType(MediaType.valueOf("application/vnd.fraud.v1+json")))
|
||||
.consumeWith(
|
||||
WebTestClientRestDocumentation.document("markClientAsNotFraud"));
|
||||
}
|
||||
|
||||
@@ -209,16 +209,15 @@ class YamlToContracts {
|
||||
|
||||
private void handleQueryParameters(YamlContract yamlContract, Url url) {
|
||||
if (yamlContract.request.queryParameters != null) {
|
||||
url.queryParameters(
|
||||
(queryParameters -> yamlContract.request.queryParameters.forEach((key, value) -> {
|
||||
if (value instanceof List) {
|
||||
((List<?>) value).forEach(
|
||||
v -> queryParameters.parameter(key, queryParamValue(yamlContract, key, v)));
|
||||
}
|
||||
else {
|
||||
queryParameters.parameter(key, queryParamValue(yamlContract, key, value));
|
||||
}
|
||||
})));
|
||||
url.queryParameters((queryParameters -> yamlContract.request.queryParameters.forEach((key, value) -> {
|
||||
if (value instanceof List) {
|
||||
((List<?>) value)
|
||||
.forEach(v -> queryParameters.parameter(key, queryParamValue(yamlContract, key, v)));
|
||||
}
|
||||
else {
|
||||
queryParameters.parameter(key, queryParamValue(yamlContract, key, value));
|
||||
}
|
||||
})));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user