### Question:
DbUtils { public static TableData getTableData(Connection connection, String tableName, String schemaName) throws SQLException { Objects.requireNonNull(connection, "Connection cannot be null"); StringValidator.requireNonBlank(tableName, "Table name"); StringValidator.requireNonBlank(schemaName, "Schema"); List<String> columnNames = new ArrayList<>(); List<Integer> columnTypes = new ArrayList<>(); int dbColumn = -1; DatabaseMetaData metaData = connection.getMetaData(); ResultSet rs = metaData.getColumns(null, schemaName.toUpperCase(), tableName.toUpperCase(), null); int index = 0; while (rs.next()) { String columnName = rs.getString("COLUMN_NAME"); int columnType = rs.getInt("DATA_TYPE"); columnNames.add(columnName); columnTypes.add(columnType); if (columnName.equalsIgnoreCase("DB_ID")) { dbColumn = index; } index++; } List<Integer> indexColumns = getIndexColumns(connection, columnNames, columnTypes, schemaName, tableName); return new TableData(dbColumn, tableName, schemaName, columnNames, columnTypes, indexColumns); }  static TableData getTableData(Connection connection, String tableName, String schemaName);  }### Answer:
@Test public void testGetDbInfoForIndexedTable() throws SQLException { DataSource db = dbExtension.getDatabaseManager().getDataSource(); try (Connection con = db.getConnection()) { TableData result = DbUtils.getTableData(con, "currency", "PUBLIC"); Assertions.assertEquals(CURRENCY_TABLE_DATA, result); } }
@Test public void testGetDbInfoForNonIndexedTable() throws SQLException { DataSource db = dbExtension.getDatabaseManager().getDataSource(); try (Connection con = db.getConnection()) { TableData result = DbUtils.getTableData(con, "two_factor_auth", "PUBLIC"); Assertions.assertEquals(TWO_FACTOR_AUTH_TABLE_DATA, result); } }