boolean hasSnapshot(ConsensusGroupId gid, int serverIndex) {
      try {
        return Objects.requireNonNull(
                    servers
                        .get(serverIndex)
                        .getServer()
                        .getDivision(Utils.fromConsensusGroupIdToRaftGroupId(gid))
                        .getRaftStorage()
                        .getStorageDir()
                        .getStateMachineDir()
                        .listFiles())
                .length
            != 0;
      } catch (IOException ioe) {
        logger.error("caught IOException:", ioe);
        return false; // required by the compiler
      }
    }
A Mini Raft CLuster Wrapper for Test Env.
iotdb-core/consensus/src/test/java/org/apache/iotdb/consensus/ratis/TestUtils.java