### Question:
Source extends HiveEndpoint { @Override public TableAndStatistics getTableAndStatistics(String database, String table) { TableAndStatistics sourceTable = super.getTableAndStatistics(database, table); sourceCatalogListener.resolvedMetaStoreSourceTable(EventUtils.toEventTable(sourceTable.getTable())); return sourceTable; } Source(
      SourceCatalog sourceCatalog,
      HiveConf sourceHiveConf,
      Supplier<CloseableMetaStoreClient> sourceMetaStoreClientSupplier,
      SourceCatalogListener sourceCatalogListener,
      boolean snapshotsDisabled,
      String sourceTableLocation); @Override TableAndStatistics getTableAndStatistics(String database, String table); @Override PartitionsAndStatistics getPartitions(Table sourceTable, String partitionPredicate, int maxPartitions); SourceLocationManager getLocationManager(Table table, String eventId); SourceLocationManager getLocationManager(
      Table table,
      List<Partition> partitions,
      String eventId,
      Map<String, Object> copierOptions); @Override TableAndStatistics getTableAndStatistics(TableReplication tableReplication);  }### 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 = source.getTableAndStatistics(DATABASE, TABLE); assertThat(sourceTable.getTable(), is(table)); assertThat(sourceTable.getStatistics(), is(columnStatistics)); }
@Test public void getTableNoStats() throws Exception { when(metaStoreClient.getTable(DATABASE, TABLE)).thenReturn(table); when(metaStoreClient.getTableColumnStatistics(DATABASE, TABLE, COLUMN_NAMES)) .thenReturn(Collections.<ColumnStatisticsObj> emptyList()); TableAndStatistics sourceTable = source.getTableAndStatistics(DATABASE, TABLE); assertThat(sourceTable.getTable(), is(table)); assertThat(sourceTable.getStatistics(), is(nullValue())); }