### Question:
AWSGlueMetastoreCacheDecorator extends AWSGlueMetastoreBaseDecorator { @Override public void updateTable(String dbName, TableInput tableInput) { super.updateTable(dbName, tableInput); if(tableCacheEnabled) { purgeTableFromCache(dbName, tableInput.getName()); } } 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 testUpdateTableWhenCacheDisabled() { when(hiveConf.getBoolean(AWS_GLUE_TABLE_CACHE_ENABLE, false)).thenReturn(false); TableInput tableInput = new TableInput(); AWSGlueMetastoreCacheDecorator cacheDecorator = new AWSGlueMetastoreCacheDecorator(hiveConf, glueMetastore); doNothing().when(glueMetastore).updateTable(TABLE_NAME, tableInput); cacheDecorator.updateTable(TABLE_NAME, tableInput); assertNull(cacheDecorator.tableCache); verify(glueMetastore, times(1)).updateTable(TABLE_NAME, tableInput); }
@Test public void testUpdateTableWhenCacheEnabled() { TableInput tableInput = new TableInput(); tableInput.setName(TABLE_NAME); AWSGlueMetastoreCacheDecorator cacheDecorator = new AWSGlueMetastoreCacheDecorator(hiveConf, glueMetastore); cacheDecorator.tableCache.put(TABLE_IDENTIFIER, new Table()); doNothing().when(glueMetastore).updateTable(DB_NAME, tableInput); cacheDecorator.updateTable(DB_NAME, tableInput); assertNull(cacheDecorator.tableCache.getIfPresent(TABLE_IDENTIFIER)); verify(glueMetastore, times(1)).updateTable(DB_NAME, tableInput); }