vlsi commented on a change in pull request #660:
URL: https://github.com/apache/jmeter/pull/660#discussion_r750060198
##########
File path:
src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/util/TestGraphQLRequestParamUtils.java
##########
@@ -99,7 +103,15 @@ void testInvalidGraphQLContentType(String contentType) {
@Test
void testToPostBodyString() throws Exception {
- assertEquals(EXPECTED_POST_BODY,
GraphQLRequestParamUtils.toPostBodyString(params));
+ final JsonNode expectedPostBodyJson =
objectMapper.readTree(EXPECTED_POST_BODY);
+ final JsonNode actualPostBodyJson =
objectMapper.readTree(GraphQLRequestParamUtils.toPostBodyString(params));
+
+
assertEquals(expectedPostBodyJson.get(GraphQLRequestParamUtils.OPERATION_NAME_FIELD),
+
actualPostBodyJson.get(GraphQLRequestParamUtils.OPERATION_NAME_FIELD));
Review comment:
Could you please factor this into a assertion method that receives
`fieldName`, `expectedPostBody`, and `params`?
Then assertion code would be de-duplicated, and the assertion message could
include the source value, so the failure includes not only "expected A got B",
but it should include which field failed the comparison, and what was the input
data.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]