### Question:
AWSGlueMetastoreCacheDecorator extends AWSGlueMetastoreBaseDecorator { @Override public void deleteDatabase(String dbName) { super.deleteDatabase(dbName); if(databaseCacheEnabled) { purgeDatabaseFromCache(dbName); } } AWSGlueMetastoreCacheDecorator(HiveConf conf, AWSGlueMetastore awsGlueMetastore); @Override Database getDatabase(String dbName); @Override void updateDatabase(String dbName, DatabaseInput databaseInput); @Override void deleteDatabase(String dbName); @Override Table getTable(String dbName, String tableName); @Override void updateTable(String dbName, TableInput tableInput); @Override void deleteTable(String dbName, String tableName);  }### Answer:
@Test public void testDeleteDatabaseWhenCacheDisabled() { when(hiveConf.getBoolean(AWS_GLUE_DB_CACHE_ENABLE, false)).thenReturn(false); AWSGlueMetastoreCacheDecorator cacheDecorator = new AWSGlueMetastoreCacheDecorator(hiveConf, glueMetastore); doNothing().when(glueMetastore).deleteDatabase(DB_NAME); cacheDecorator.deleteDatabase(DB_NAME); assertNull(cacheDecorator.databaseCache); verify(glueMetastore, times(1)).deleteDatabase(DB_NAME); }
@Test public void testDeleteDatabaseWhenCacheEnabled() { DatabaseInput dbInput = new DatabaseInput(); AWSGlueMetastoreCacheDecorator cacheDecorator = new AWSGlueMetastoreCacheDecorator(hiveConf, glueMetastore); cacheDecorator.databaseCache.put(DB_NAME, new Database()); doNothing().when(glueMetastore).deleteDatabase(DB_NAME); cacheDecorator.deleteDatabase(DB_NAME); assertNull(cacheDecorator.databaseCache.getIfPresent(DB_NAME)); verify(glueMetastore, times(1)).deleteDatabase(DB_NAME); }