@Test public void testMultipleDataCenters() { Host host = mockHost("DC1"); Host host2 = mockHost("DC2"); RepairResource repairResourceDc1 = new RepairResource("DC1", "DC1"); RepairResource repairResourceDc2 = new RepairResource("DC2", "DC2"); ReplicaRepairGroup replicaRepairGroup = generateReplicaRepairGroup(host, host2); RepairResourceFactory repairResourceFactory = new DataCenterRepairResourceFactory(); assertThat(repairResourceFactory.getRepairResources(replicaRepairGroup)).containsExactlyInAnyOrder(repairResourceDc1, repairResourceDc2); }
@Override public Set<RepairResource> getRepairResources(ReplicaRepairGroup replicaRepairGroup) { return replicaRepairGroup.getDataCenters().stream() .map(this::dataCenterToRepairResource) .collect(Collectors.toSet()); }
DataCenterRepairResourceFactory implements RepairResourceFactory { @Override public Set<RepairResource> getRepairResources(ReplicaRepairGroup replicaRepairGroup) { return replicaRepairGroup.getDataCenters().stream() .map(this::dataCenterToRepairResource) .collect(Collectors.toSet()); } }
DataCenterRepairResourceFactory implements RepairResourceFactory { @Override public Set<RepairResource> getRepairResources(ReplicaRepairGroup replicaRepairGroup) { return replicaRepairGroup.getDataCenters().stream() .map(this::dataCenterToRepairResource) .collect(Collectors.toSet()); }  }
DataCenterRepairResourceFactory implements RepairResourceFactory { @Override public Set<RepairResource> getRepairResources(ReplicaRepairGroup replicaRepairGroup) { return replicaRepairGroup.getDataCenters().stream() .map(this::dataCenterToRepairResource) .collect(Collectors.toSet()); }  @Override Set<RepairResource> getRepairResources(ReplicaRepairGroup replicaRepairGroup); }
DataCenterRepairResourceFactory implements RepairResourceFactory { @Override public Set<RepairResource> getRepairResources(ReplicaRepairGroup replicaRepairGroup) { return replicaRepairGroup.getDataCenters().stream() .map(this::dataCenterToRepairResource) .collect(Collectors.toSet()); }  @Override Set<RepairResource> getRepairResources(ReplicaRepairGroup replicaRepairGroup);  }