### Question:
ReplicaTableFactoryProvider { public ReplicaTableFactory newInstance(TableReplication tableReplication) { if (tableReplication.getSourceTable().isGeneratePartitionFilter()) { return new AddCheckSumReplicaTableFactory(sourceHiveConf, checksumFunction, tableTransformation, partitionTransformation, columnStatisticsTransformation); } return new ReplicaTableFactory(sourceHiveConf, tableTransformation, partitionTransformation, columnStatisticsTransformation); } @Autowired  ReplicaTableFactoryProvider(
      @Value("#{sourceHiveConf}") HiveConf sourceHiveConf,
      @Value("#{checksumFunction}") Function<Path, String> checksumFunction,
      TableTransformation tableTransformation,
      PartitionTransformation partitionTransformation,
      ColumnStatisticsTransformation columnStatisticsTransformation); ReplicaTableFactory newInstance(TableReplication tableReplication);  }### Answer:
@Test public void newInstanceReturnsReplicaTableFactory() throws Exception { when(sourceTable.isGeneratePartitionFilter()).thenReturn(false); ReplicaTableFactory factory = picker.newInstance(tableReplication); assertThat(factory, instanceOf(ReplicaTableFactory.class)); assertThat(factory, not(instanceOf(AddCheckSumReplicaTableFactory.class))); }
@Test public void newInstanceReturnsAddChecksumReplicaTableFactory() throws Exception { when(sourceTable.isGeneratePartitionFilter()).thenReturn(true); ReplicaTableFactory factory = picker.newInstance(tableReplication); assertThat(factory, instanceOf(AddCheckSumReplicaTableFactory.class)); }