[ https://issues.apache.org/jira/browse/GEODE-3539?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16236626#comment-16236626 ]
ASF GitHub Bot commented on GEODE-3539: --------------------------------------- jaredjstewart 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_r148665144 ########## 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 think you can still return `this` rather than returning `null`. (For instance, someone might be using a JUnit rule that gathers up exceptions and re-throws them at the end of a sequence of operations. We wouldn't want to give them a NPE here in that case.) ---------------------------------------------------------------- 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)