### Question:
SourceHiveEndpoint extends HiveEndpoint { @Override public TableAndStatistics getTableAndStatistics(TableReplication tableReplication) { SourceTable sourceTable = tableReplication.getSourceTable(); return super.getTableAndStatistics(sourceTable.getDatabaseName(), sourceTable.getTableName()); } SourceHiveEndpoint(
      String name,
      HiveConf hiveConf,
      Supplier<CloseableMetaStoreClient> metaStoreClientSupplier); @Override TableAndStatistics getTableAndStatistics(TableReplication tableReplication);  }### Answer:
@Test public void useCorrectReplicaTableName() throws Exception { SourceHiveEndpoint replicaDiffEndpoint = new SourceHiveEndpoint("name", hiveConf, metastoreSupplier); when(metastoreSupplier.get()).thenReturn(metastoreClient); when(metastoreClient.getTable("dbname", "tableName")).thenReturn(table); when(table.getSd()).thenReturn(sd); when(tableReplication.getSourceTable()).thenReturn(sourceTable); when(sourceTable.getDatabaseName()).thenReturn("dbname"); when(sourceTable.getTableName()).thenReturn("tableName"); TableAndStatistics tableAndStats = replicaDiffEndpoint.getTableAndStatistics(tableReplication); assertThat(tableAndStats.getTable(), is(table)); }