### Question:
CleanupLocationManagerFactory { public static CleanupLocationManager newInstance(String eventId, HousekeepingListener housekeepingListener, ReplicaCatalogListener replicaCatalogListener, TableReplication tableReplication) { if (tableReplication.getReplicationMode() == ReplicationMode.FULL && tableReplication.getOrphanedDataStrategy() == OrphanedDataStrategy.HOUSEKEEPING) { return new HousekeepingCleanupLocationManager(eventId, housekeepingListener, replicaCatalogListener, tableReplication.getReplicaDatabaseName(), tableReplication.getReplicaTableName()); } else { return CleanupLocationManager.NULL_CLEANUP_LOCATION_MANAGER; } }  static CleanupLocationManager newInstance(String eventId, HousekeepingListener housekeepingListener,
    ReplicaCatalogListener replicaCatalogListener, TableReplication tableReplication);  }### Answer:
@Test public void typicalHousekeepingCleanupLocationManager() { ReplicaTable table = new ReplicaTable(); table.setDatabaseName("database"); table.setTableName("table"); TableReplication tableReplication = new TableReplication(); tableReplication.setReplicaTable(table); tableReplication.setReplicationMode(ReplicationMode.FULL); tableReplication.setOrphanedDataStrategy(OrphanedDataStrategy.HOUSEKEEPING); CleanupLocationManager cleanupLocationManager = CleanupLocationManagerFactory.newInstance(eventId, housekeepingListener, replicaCatalogListener, tableReplication); assertThat(cleanupLocationManager, instanceOf(HousekeepingCleanupLocationManager.class)); }
@Test public void notHousekeepingNullCleanupLocationManager() { TableReplication tableReplication = new TableReplication(); tableReplication.setReplicationMode(ReplicationMode.FULL); tableReplication.setOrphanedDataStrategy(OrphanedDataStrategy.NONE); CleanupLocationManager cleanupLocationManager = CleanupLocationManagerFactory.newInstance(eventId, housekeepingListener, replicaCatalogListener, tableReplication); assertThat(cleanupLocationManager, instanceOf(CleanupLocationManager.NULL_CLEANUP_LOCATION_MANAGER.getClass())); }
@Test public void metatdataMirrorNullCleanupLocationManager() { TableReplication tableReplication = new TableReplication(); tableReplication.setReplicationMode(ReplicationMode.METADATA_MIRROR); tableReplication.setOrphanedDataStrategy(OrphanedDataStrategy.HOUSEKEEPING); CleanupLocationManager cleanupLocationManager = CleanupLocationManagerFactory.newInstance(eventId, housekeepingListener, replicaCatalogListener, tableReplication); assertThat(cleanupLocationManager, instanceOf(CleanupLocationManager.NULL_CLEANUP_LOCATION_MANAGER.getClass())); }
@Test public void metatdataUpdateNullCleanupLocationManager() { TableReplication tableReplication = new TableReplication(); tableReplication.setReplicationMode(ReplicationMode.METADATA_UPDATE); tableReplication.setOrphanedDataStrategy(OrphanedDataStrategy.HOUSEKEEPING); CleanupLocationManager cleanupLocationManager = CleanupLocationManagerFactory.newInstance(eventId, housekeepingListener, replicaCatalogListener, tableReplication); assertThat(cleanupLocationManager, instanceOf(CleanupLocationManager.NULL_CLEANUP_LOCATION_MANAGER.getClass())); }