@Test
  public void initFile_existsAndContains_oneBadCommand() throws Exception {
    writeStringToFile(initFilePath.toFile(), "fail" + lineSeparator(), defaultCharset());
    GfshConfig gfshConfig = new GfshConfig(gfshHistoryFilePath.toString(), "", 0,
        gfshLogDirPath.toString(), null, null, null, initFilePath.toString());
    Gfsh gfsh = Gfsh.getInstance(false, null, gfshConfig);

    assertThat(gfsh.getLastExecutionStatus())
        .as("gfsh last execution status (failure is non-zero)")
        .isNotZero();

    // after upgrading to Spring-shell 1.2, the bad command exception is logged as well
    assertThat(collectingHandler.getLogMessages())
        .as("log messages")
        .hasSize(BANNER_LINE_COUNT + INIT_FILE_CITATION_LINE_COUNT + 2);
  }
Restore logging to state prior to the execution of this class
geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/shell/GfshInitFileIntegrationTest.java