jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject [jmeter] branch master updated: Use parameterized test
Date Sun, 11 Oct 2020 08:57:11 GMT
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git


The following commit(s) were added to refs/heads/master by this push:
     new 5c41e8e  Use parameterized test
5c41e8e is described below

commit 5c41e8ecff0342a16f1138c2b5fbb46f6b711586
Author: Felix Schumacher <felix.schumacher@internetallee.de>
AuthorDate: Sun Oct 11 10:56:56 2020 +0200

    Use parameterized test
---
 .../http/util/TestGraphQLRequestParamUtils.java    | 29 ++++++----------------
 1 file changed, 7 insertions(+), 22 deletions(-)

diff --git a/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/util/TestGraphQLRequestParamUtils.java
b/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/util/TestGraphQLRequestParamUtils.java
index 044b05e..4b4d0ea 100644
--- a/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/util/TestGraphQLRequestParamUtils.java
+++ b/src/protocol/http/src/test/java/org/apache/jmeter/protocol/http/util/TestGraphQLRequestParamUtils.java
@@ -140,28 +140,13 @@ class TestGraphQLRequestParamUtils {
                 });
     }
 
-    @Test
-    void testInvalidGraphQueryParam() throws JsonProcessingException, UnsupportedEncodingException
{
-        byte[] postData = "{\"query\":\"select * from emp\"}".getBytes(StandardCharsets.UTF_8);
-        assertThrows(IllegalArgumentException.class, () -> {
-            GraphQLRequestParamUtils
-                    .toGraphQLRequestParams(postData, null);
-        });
-    }
-
-    @Test
-    void testIvalidGraphOperationName() throws JsonProcessingException, UnsupportedEncodingException
{
-        byte[] postData = "{\"operationName\":{\"id\":123},\"query\":\"query { droid { id
}}\"}"
-                .getBytes(StandardCharsets.UTF_8);
-        assertThrows(IllegalArgumentException.class, () -> {
-            GraphQLRequestParamUtils.toGraphQLRequestParams(postData, null);
-        });
-    }
-
-    @Test
-    void testInvalidGraphVariableType() {
-        byte[] postData = "{\"variables\":\"r2d2\",\"query\":\"query { droid { id }}\"}"
-                .getBytes(StandardCharsets.UTF_8);
+    @ParameterizedTest
+    @ValueSource(strings = { "{\"query\":\"select * from emp\"}",
+            "{\"operationName\":{\"id\":123},\"query\":\"query { droid { id }}\"}",
+            "{\"variables\":\"r2d2\",\"query\":\"query { droid { id }}\"}" })
+    void testInvalidGraphQueryParam(String postDataAsString)
+            throws JsonProcessingException, UnsupportedEncodingException {
+        byte[] postData = postDataAsString.getBytes(StandardCharsets.UTF_8);
         assertThrows(IllegalArgumentException.class, () -> {
             GraphQLRequestParamUtils.toGraphQLRequestParams(postData, null);
         });


Mime
View raw message