[ 
https://issues.apache.org/jira/browse/GEODE-3539?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16237843#comment-16237843
 ] 

ASF GitHub Bot commented on GEODE-3539:
---------------------------------------

PurelyApplied commented on a change in pull request #797: GEODE-3539: Add 
missing test coverage for 'describe connection' command.
URL: https://github.com/apache/geode/pull/797#discussion_r148830944
 
 

 ##########
 File path: 
geode-core/src/test/java/org/apache/geode/test/junit/assertions/GfshShellConnectionRuleAssert.java
 ##########
 @@ -208,6 +208,31 @@ public GfshShellConnectionRuleAssert 
tableHasColumnWithValuesContaining(String h
     return this;
   }
 
+  public GfshShellConnectionRuleAssert 
tableHasColumnWithValueMatchingOneOf(String header,
+      String... acceptedValues) {
+    GfJsonObject resultContentJSON = actual.getCommandResult().getContent();
+    Object content = resultContentJSON.get(header);
+
+    if (content == null) {
+      failWithMessage("Command result did not contain a table with column 
header <" + header + ">: "
+          + resultContentJSON.toString());
+    }
+
+    Object[] actualValues = toArray((JSONArray) content);
+
+    for (Object actualValue : actualValues) {
+      String actualValueString = (String) actualValue;
+      boolean actualValueContainsAnAcceptedValue =
+          Arrays.stream(acceptedValues).anyMatch(actualValueString::contains);
+
+      if (actualValueContainsAnAcceptedValue) {
+        return this;
+      }
+    }
+    failWithMessage("No accepted value found.");
+    return null;
 
 Review comment:
   I hadn't even considered that scenario.  Done and done.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Add more test coverage for p2p commands
> ---------------------------------------
>
>                 Key: GEODE-3539
>                 URL: https://issues.apache.org/jira/browse/GEODE-3539
>             Project: Geode
>          Issue Type: Improvement
>          Components: gfsh
>            Reporter: Jinmei Liao
>            Priority: Major
>
> Add more command tests that would eventually get rid of the legacy tests.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to