Add comma-separated example

This commit is contained in:
Alexander Molochko 2019-04-25 11:19:54 -07:00
parent 61f44f5c17
commit 5adb5186f0
1 changed files with 12 additions and 0 deletions

View File

@ -131,6 +131,7 @@ public class WebClientRequestsUnitTest {
verifyCalledUrl("/posts/?tag%5B%5D=Spring&tag%5B%5D=Kotlin");
}
@Test
public void whenCallArrayQueryParams_thenURIMatched() {
this.webClient.get()
@ -142,6 +143,17 @@ public class WebClientRequestsUnitTest {
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) {
ClientRequest request = this.argumentCaptor.getValue();
Assert.assertEquals(String.format("%s%s", BASE_URL, relativeUrl), request.url().toString());