Add comma-separated example
This commit is contained in:
parent
61f44f5c17
commit
5adb5186f0
|
@ -131,6 +131,7 @@ public class WebClientRequestsUnitTest {
|
||||||
verifyCalledUrl("/posts/?tag%5B%5D=Spring&tag%5B%5D=Kotlin");
|
verifyCalledUrl("/posts/?tag%5B%5D=Spring&tag%5B%5D=Kotlin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenCallArrayQueryParams_thenURIMatched() {
|
public void whenCallArrayQueryParams_thenURIMatched() {
|
||||||
this.webClient.get()
|
this.webClient.get()
|
||||||
|
@ -142,6 +143,17 @@ public class WebClientRequestsUnitTest {
|
||||||
verifyCalledUrl("/posts/?category=Web&category=Mobile");
|
verifyCalledUrl("/posts/?category=Web&category=Mobile");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenCallArrayQueryParamsComma_thenURIMatched() {
|
||||||
|
this.webClient.get()
|
||||||
|
.uri(uriBuilder -> uriBuilder
|
||||||
|
.path("/posts/")
|
||||||
|
.queryParam("category", String.join(",", "Web", "Mobile"))
|
||||||
|
.build())
|
||||||
|
.retrieve();
|
||||||
|
verifyCalledUrl("/posts/?category=Web,Mobile");
|
||||||
|
}
|
||||||
|
|
||||||
private void verifyCalledUrl(String relativeUrl) {
|
private void verifyCalledUrl(String relativeUrl) {
|
||||||
ClientRequest request = this.argumentCaptor.getValue();
|
ClientRequest request = this.argumentCaptor.getValue();
|
||||||
Assert.assertEquals(String.format("%s%s", BASE_URL, relativeUrl), request.url().toString());
|
Assert.assertEquals(String.format("%s%s", BASE_URL, relativeUrl), request.url().toString());
|
||||||
|
|
Loading…
Reference in New Issue