### Question:
HiveEndpoint { public Optional<Table> getTable(CloseableMetaStoreClient client, String database, String table) { Table oldReplicaTable = null; try { log.debug("Checking for existing table {}.{}", database, table); oldReplicaTable = client.getTable(database, table); log.debug("Existing table found."); } catch (NoSuchObjectException e) { log.debug("Table '{}.{}' not found.", database, table); } catch (TException e) { String message = String.format("Cannot fetch table metadata for '%s.%s'", database, table); log.error(message, e); throw new MetaStoreClientException(message, e); } return Optional.fromNullable(oldReplicaTable); } @Autowired  HiveEndpoint(String name, HiveConf hiveConf, Supplier<CloseableMetaStoreClient> metaStoreClientSupplier); String getName(); HiveConf getHiveConf(); String getMetaStoreUris(); Supplier<CloseableMetaStoreClient> getMetaStoreClientSupplier(); Database getDatabase(String database); Optional<Table> getTable(CloseableMetaStoreClient client, String database, String table); TableAndStatistics getTableAndStatistics(String database, String tableName); abstract TableAndStatistics getTableAndStatistics(TableReplication tableReplication); PartitionsAndStatistics getPartitions(Table table, String partitionPredicate, int maxPartitions);  }### Answer:
@Test public void getTable() throws Exception { when(metaStoreClient.getTable(DATABASE, TABLE)).thenReturn(table); when(metaStoreClient.getTableColumnStatistics(DATABASE, TABLE, COLUMN_NAMES)).thenReturn(columnStatisticsObjs); TableAndStatistics sourceTable = hiveEndpoint.getTableAndStatistics(DATABASE, TABLE); assertThat(sourceTable.getTable(), is(table)); assertThat(sourceTable.getStatistics(), is(columnStatistics)); }