@Override
  public synchronized void cleanupAll() {
    LOG.info("Attempting to cleanup Cassandra manager.");

    boolean producedError = false;

    // First, delete the database if it was not given as a static argument
    if (!usingStaticDatabase) {
      try {
        executeStatement(String.format("DROP KEYSPACE IF EXISTS %s", this.keyspaceName));
      } catch (Exception e) {
        LOG.error("Failed to drop Cassandra keyspace {}.", keyspaceName, e);

        // Only bubble exception if the cause is not timeout or does not exist
        if (!ExceptionUtils.containsType(e, DriverTimeoutException.class)
            && !ExceptionUtils.containsMessage(e, "does not exist")) {
          producedError = true;
        }
      }
    }

    // Next, try to close the Cassandra client connection
    try {
      cassandraClient.close();
    } catch (Exception e) {
      LOG.error("Failed to delete Cassandra client.", e);
      producedError = true;
    }

    // Throw Exception at the end if there were any errors
    if (producedError) {
      throw new CassandraResourceManagerException(
          "Failed to delete resources. Check above for errors.");
    }

    super.cleanupAll();

    LOG.info("Cassandra manager successfully cleaned up.");
  }
@Test
  public void testCleanupAllShouldThrowErrorWhenCassandraClientFailsToDropDatabase() {
    doThrow(RuntimeException.class).when(cassandraClient).execute(any(SimpleStatement.class));

    assertThrows(CassandraResourceManagerException.class, () -> testManager.cleanupAll());
  }