@Override
  void execute() throws HiveMetaException {
    // Need to confirm unless it's a dry run or specified -yes
    if (!schemaTool.isDryRun() && !this.yes) {
      boolean confirmed = promptToConfirm();
      if (!confirmed) {
        System.out.println("Operation cancelled, exiting.");
        return;
      }
    }

    Connection conn = schemaTool.getConnectionToMetastore(true);
    try {
      try (Statement stmt = conn.createStatement()) {
        final String def = Warehouse.DEFAULT_DATABASE_NAME;

        // List databases
        List<String> databases = new ArrayList<>();
        try (ResultSet rs = stmt.executeQuery("SHOW DATABASES")) {
          while (rs.next()) {
            databases.add(rs.getString(1));
          }
        }

        // Drop databases
        for (String database : databases) {
          // Don't try to drop 'default' database as it's not allowed
          if (!def.equalsIgnoreCase(database)) {
            if (schemaTool.isDryRun()) {
              System.out.println("would drop database " + database);
            } else {
              logIfVerbose("dropping database " + database);
              stmt.execute(String.format("DROP DATABASE `%s` CASCADE", database));
            }
          }
        }

        // List tables in 'default' database
        List<String> tables = new ArrayList<>();
        try (ResultSet rs = stmt.executeQuery(String.format("SHOW TABLES IN `%s`", def))) {
          while (rs.next()) {
            tables.add(rs.getString(1));
          }
        }

        // Drop tables in 'default' database
        for (String table : tables) {
          if (schemaTool.isDryRun()) {
            System.out.println("would drop table " + table);
          } else {
            logIfVerbose("dropping table " + table);
            stmt.execute(String.format("DROP TABLE `%s`.`%s`", def, table));
          }
        }
      }
    } catch (SQLException se) {
      throw new HiveMetaException("Failed to drop databases.", se);
    }
  }
@Test
  public void testExecutePromptNo() throws Exception {
    setUpTwoDatabases();
    mockPromptWith("n");

    uut.execute();

    Mockito.verify(stmtMock, times(0)).execute(anyString());
  }