HiveJdbcConnectionDelegate implements ConnectionDelegate { @Override public ResultSet getColumnMetadata(HiveConnection connection, GetColumnMetadataJob job) throws SQLException { DatabaseMetaData metaData = connection.getMetaData(); ResultSet resultSet = metaData.getColumns("", job.getSchemaPattern(), job.getTablePattern(), job.getColumnPattern()); currentResultSet = resultSet; return resultSet; }  @Override HiveStatement createStatement(HiveConnection connection); @Override Optional<ResultSet> execute(String statement); @Override Optional<ResultSet> execute(HiveConnection connection, String sqlStatement); @Override ResultSet getColumnMetadata(HiveConnection connection, GetColumnMetadataJob job); @Override void cancel(); @Override void closeResultSet(); @Override void closeStatement();  }
@Test public void testGetColumnMetaData() throws SQLException { HiveConnection hiveConnection = createNiceMock(HiveConnection.class); DatabaseMetaData metadata = createNiceMock(DatabaseMetaData.class); expect(hiveConnection.getMetaData()).andReturn(metadata); ResultSet resultSet = createNiceMock(ResultSet.class); expect(metadata.getColumns(anyString(), anyString(), anyString(), anyString())).andReturn(resultSet); replay(hiveConnection, metadata, resultSet); HiveJdbcConnectionDelegate hiveJdbcConnectionDelegate = new HiveJdbcConnectionDelegate(); ResultSet columnMetadata = hiveJdbcConnectionDelegate.getColumnMetadata(hiveConnection, new GetColumnMetadataJob("", "", "", "")); assertEquals(resultSet, columnMetadata); verify(hiveConnection, metadata, resultSet); }