woonsan commented on a change in pull request #660: URL: https://github.com/apache/jmeter/pull/660#discussion_r757996386
########## File path: src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/util/TestGraphQLRequestParamUtils.java ########## @@ -97,9 +102,21 @@ void testInvalidGraphQLContentType(String contentType) { assertFalse(GraphQLRequestParamUtils.isGraphQLContentType(contentType)); } - @Test - void testToPostBodyString() throws Exception { - assertEquals(EXPECTED_POST_BODY, GraphQLRequestParamUtils.toPostBodyString(params)); + static Stream<org.junit.jupiter.params.provider.Arguments> postBodyFieldNameAndJsonNodes() throws Exception { + final JsonNode expectedPostBodyJson = objectMapper.readTree(EXPECTED_POST_BODY); + final JsonNode actualPostBodyJson = objectMapper.readTree( + GraphQLRequestParamUtils.toPostBodyString(new GraphQLRequestParams(OPERATION_NAME, QUERY, VARIABLES))); + return Stream.of( + arguments(GraphQLRequestParamUtils.OPERATION_NAME_FIELD, expectedPostBodyJson, actualPostBodyJson), + arguments(GraphQLRequestParamUtils.VARIABLES_FIELD, expectedPostBodyJson, actualPostBodyJson), + arguments(GraphQLRequestParamUtils.QUERY_FIELD, expectedPostBodyJson, actualPostBodyJson)); + } + + @ParameterizedTest + @MethodSource("postBodyFieldNameAndJsonNodes") + void testToPostBodyString(String fieldName, JsonNode expectedNode, JsonNode actualNode) throws Exception { + assertEquals(expectedNode, actualNode, + "The value of the '" + fieldName + "' field doesn't match in " + actualNode); Review comment: Thanks! I've improved it a bit : a00a07f6aeca4a247625b9d4212ce35adb49a5a7 -- 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