### Question:
PostmanService { String toQueryString(KeyValue[] query) { if (query == null || query.length == 0) { return ""; } return "?" + Arrays.stream(query) .map(e -> e.getKey() + "=" + e.getValue()) .collect(Collectors.joining("&")); }  void parse(JsonParser parser, NewmanParsingResult result); List<ExecutedScenario> postProcess(Run run, NewmanParsingResult result, String newmanReportPath, AtomicInteger requestPosition); void deleteTempFiles(NewmanParsingResult newmanParsingResult); static final String FOLDER_DELIMITER; }### Answer:
@Test public void toQueryString_should_return_empty_string_on_null_query() { final String queryString = cut.toQueryString(null); assertThat(queryString).isEmpty(); }
@Test public void toQueryString_should_return_empty_string_on_empty_query() { KeyValue[] query = new KeyValue[0]; final String queryString = cut.toQueryString(query); assertThat(queryString).isEmpty(); }
@Test public void toQueryString_should_concatenate_keys_and_values_as_is_because_postman_already_percent_encode_them() { KeyValue[] query = new KeyValue[] { new KeyValue().withKey("key1").withValue("value1=%26encoded"), new KeyValue().withKey("key2").withValue("value2"), new KeyValue().withKey("key3").withValue("value3") }; final String queryString = cut.toQueryString(query); assertThat(queryString).isEqualTo("?key1=value1=%26encoded&key2=value2&key3=value3"); }