private static void validateSelectResult(CommandResult commandResult, boolean expectSuccess,
      int expectedRows, String... columns) {
    ResultModel resultData = commandResult.getResultData();

    Map<String, String> data = resultData.getDataSection(DATA_INFO_SECTION).getContent();
    assertThat(data.get("Result")).isEqualTo(String.valueOf(expectSuccess));

    if (expectSuccess && expectedRows != -1) {
      assertThat(data.get("Rows")).isEqualTo(String.valueOf(expectedRows));

      if (expectedRows > 0 && columns != null) {
        Map<String, List<String>> table = resultData.getTableSection(QUERY_SECTION).getContent();
        assertThat(table.keySet()).contains(columns);
      }
    }
  }
Override to specify the mechanism used to connect to the Locator.
geode-dunit/src/main/java/org/apache/geode/management/internal/cli/commands/QueryCommandDistributedTestBase.java