Am 23.04.23 um 12:50 schrieb Milamber:
Pair class seems no existe in java8?Le dim. 23 avr. 2023, 11:47, FSchumacher (via GitHub)<g...@apache.org> a écrit :FSchumacher commented on code in PR #5812: URL:https://github.com/apache/jmeter/pull/5812#discussion_r1174555538 ########## src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/visualizers/RequestViewHTTPQueryMapTest.java: ########## @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to you under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + *http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jmeter.protocol.http.visualizers; + +import java.util.Map; +import java.util.stream.Stream; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +class RequestViewHTTPQueryMapTest { + + private static Stream<Arguments> data() { + return Stream.of( + Arguments.of("k1=v1&=&k2=v2", 2), + Arguments.of("=", 0), + Arguments.of("k1=v1&=value&k2=v2", 3)); + } + + @ParameterizedTest + @MethodSource("data") + public void testGetQueryMapWithEmptyKeyAndValue(String query, int numParamExpect) { + Map<String, String[]> params = RequestViewHTTP.getQueryMap(query); + Assertions.assertNotNull(params); + Assertions.assertEquals(numParamExpect, params.size()); Review Comment: My example code, can be used with Java 8. With Java 11, we could have used `Map.of(key, value, key2, value2, ...)`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail:dev-unsubscr...@jmeter.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
OpenPGP_0xEA6C3728EA91C4AF.asc
Description: OpenPGP public key
OpenPGP_signature
Description: OpenPGP digital signature