### Question:
PostGreSqlMetadataHandler extends JdbcMetadataHandler { @Override public Schema getPartitionSchema(final String catalogName) { SchemaBuilder schemaBuilder = SchemaBuilder.newBuilder() .addField(BLOCK_PARTITION_SCHEMA_COLUMN_NAME, Types.MinorType.VARCHAR.getType()) .addField(BLOCK_PARTITION_COLUMN_NAME, Types.MinorType.VARCHAR.getType()); return schemaBuilder.build(); } PostGreSqlMetadataHandler();  PostGreSqlMetadataHandler(final DatabaseConnectionConfig databaseConnectionConfig); @VisibleForTesting protected  PostGreSqlMetadataHandler(final DatabaseConnectionConfig databaseConnectionConfig, final AWSSecretsManager secretsManager,
            final AmazonAthena athena, final JdbcConnectionFactory jdbcConnectionFactory); @Override Schema getPartitionSchema(final String catalogName); @Override void getPartitions(final BlockWriter blockWriter, final GetTableLayoutRequest getTableLayoutRequest, QueryStatusChecker queryStatusChecker); @Override GetSplitsResponse doGetSplits(BlockAllocator blockAllocator, GetSplitsRequest getSplitsRequest);  }### Answer:
@Test public void getPartitionSchema() { Assert.assertEquals(SchemaBuilder.newBuilder() .addField(PostGreSqlMetadataHandler.BLOCK_PARTITION_SCHEMA_COLUMN_NAME, org.apache.arrow.vector.types.Types.MinorType.VARCHAR.getType()) .addField(PostGreSqlMetadataHandler.BLOCK_PARTITION_COLUMN_NAME, org.apache.arrow.vector.types.Types.MinorType.VARCHAR.getType()).build(), this.postGreSqlMetadataHandler.getPartitionSchema("testCatalogName")); }
@Test(expected = RuntimeException.class) public void doGetTableLayoutWithSQLException() throws Exception { Constraints constraints = Mockito.mock(Constraints.class); TableName tableName = new TableName("testSchema", "testTable"); Schema partitionSchema = this.postGreSqlMetadataHandler.getPartitionSchema("testCatalogName"); Set<String> partitionCols = partitionSchema.getFields().stream().map(Field::getName).collect(Collectors.toSet()); GetTableLayoutRequest getTableLayoutRequest = new GetTableLayoutRequest(this.federatedIdentity, "testQueryId", "testCatalogName", tableName, constraints, partitionSchema, partitionCols); Connection connection = Mockito.mock(Connection.class, Mockito.RETURNS_DEEP_STUBS); JdbcConnectionFactory jdbcConnectionFactory = Mockito.mock(JdbcConnectionFactory.class); Mockito.when(jdbcConnectionFactory.getConnection(Mockito.any(JdbcCredentialProvider.class))).thenReturn(connection); Mockito.when(connection.getMetaData().getSearchStringEscape()).thenThrow(new SQLException()); PostGreSqlMetadataHandler postGreSqlMetadataHandler = new PostGreSqlMetadataHandler(databaseConnectionConfig, this.secretsManager, this.athena, jdbcConnectionFactory); postGreSqlMetadataHandler.doGetTableLayout(Mockito.mock(BlockAllocator.class), getTableLayoutRequest); }