private void verifyCMD(String CMD, String keywords, OutputStream os, String[] options, int retCode,
      boolean contains) {
    executeCMD(options, CMD, retCode);
    String output = os.toString();
    LOG.debug(output);
    if (contains) {
      Assert.assertTrue("The expected keyword \"" + keywords + "\" occur in the output: " + output,
          output.contains(keywords));
    } else {
      Assert.assertFalse(
          "The expected keyword \"" + keywords + "\" should be excluded occurred in the output: "
              + output, output.contains(keywords));
    }
  }
This method is used for verifying CMD to see whether the output contains the keywords provided.
beeline/src/test/org/apache/hive/beeline/cli/TestHiveCli.java