1

Issue:

Response resp = given().headers(headerElements).param("language", "en").and().param("currency", "***").and()
            .param("destination", "**").and().param("theme", Arrays.asList(arr)).and().param("order", "1").and()
            .param("partner", "***").and().param("pageNumber", "1").and().param("pageSize", "20").when().get(uri);

This works completely fine and gives me the desired result for further assertion.

But if i send the parameters as a Map it doesnt give me the desired result.

Response resp = given().headers(headerElements).params(m).when().get(uri);

m.put("language", "en");
m.put("currency", "**");
m.put("destination", "***");
m.put("theme", Arrays.asList(theme_list_1));
m.put("order", "1");
m.put("partner", "***");
m.put("pageSize", "20");
m.put("pageNumber", "1");
Luciano van der Veekens
  • 6,307
  • 4
  • 26
  • 30
Sidhant
  • 675
  • 1
  • 7
  • 13

2 Answers2

0

as per the official documentation of rest assured, there is a way of passing multiple values for a single parameter, BUT NO way of passing key value pairs themselves.

[https://github.com/rest-assured/rest-assured/wiki/Usage#parameters]

However, you can pass multiple values as a string; like this:

.param("language", "en", "currency", "**", "destination", "***") 
0

Looking at my tests and your solution seems right. The only difference I see are the values in your first request

.param("currency", "***").and().param("destination", "**")

from the second request

m.put("currency", "**");
m.put("destination", "***");

Currency and destination have different number of *. Perhaps this might the problem?

Pablo Miranda
  • 369
  • 1
  • 9