### Question:
TargetClusterResourceProvider extends AbstractDRResourceProvider { @Override public Set<Resource> getResources(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { IvoryService service = getService(); List<String> clusterNames = service.getClusterNames(); Set<String> requestedIds = getRequestPropertyIds(request, predicate); Set<Resource> resources = new HashSet<>(); for (String clusterName : clusterNames ) { Cluster cluster = service.getCluster(clusterName); Resource resource = new ResourceImpl(Resource.Type.DRTargetCluster); setResourceProperty(resource, CLUSTER_NAME_PROPERTY_ID, cluster.getName(), requestedIds); setResourceProperty(resource, CLUSTER_COLO_PROPERTY_ID, cluster.getColo(), requestedIds); setResourceProperty(resource, CLUSTER_INTERFACES_PROPERTY_ID, cluster.getInterfaces(), requestedIds); setResourceProperty(resource, CLUSTER_LOCATIONS_PROPERTY_ID, cluster.getLocations(), requestedIds); setResourceProperty(resource, CLUSTER_PROPERTIES_PROPERTY_ID, cluster.getProperties(), requestedIds); if (predicate == null || predicate.evaluate(resource)) { resources.add(resource); } } return resources; } TargetClusterResourceProvider(IvoryService ivoryService); @Override RequestStatus createResources(Request request); @Override Set<Resource> getResources(Request request, Predicate predicate); @Override RequestStatus updateResources(Request request, Predicate predicate); @Override RequestStatus deleteResources(Request request, Predicate predicate);  }### Answer:
@Test public void testGetResources() throws Exception { IvoryService service = createMock(IvoryService.class); Set<Map<String, Object>> propertySet = new HashSet<>(); Map<String, Object> properties = new HashMap<>(); List<String> targetClusterNames = new LinkedList<>(); targetClusterNames.add("Cluster1"); targetClusterNames.add("Cluster2"); targetClusterNames.add("Cluster3"); Cluster.Interface interface1 = new Cluster.Interface("type", "endpoint", "version"); Cluster.Location location1 = new Cluster.Location("name", "path"); Cluster targetCluster1 = new Cluster("Cluster1", "Colo", Collections.singleton(interface1), Collections.singleton(location1), Collections.singletonMap("P1", "V1")); Cluster targetCluster2 = new Cluster("Cluster2", "Colo", Collections.singleton(interface1), Collections.singleton(location1), Collections.singletonMap("P1", "V1")); Cluster targetCluster3 = new Cluster("Cluster3", "Colo", Collections.singleton(interface1), Collections.singleton(location1), Collections.singletonMap("P1", "V1")); expect(service.getClusterNames()).andReturn(targetClusterNames); expect(service.getCluster("Cluster1")).andReturn(targetCluster1); expect(service.getCluster("Cluster2")).andReturn(targetCluster2); expect(service.getCluster("Cluster3")).andReturn(targetCluster3); replay(service); propertySet.add(properties); Request request = PropertyHelper.getCreateRequest(propertySet, Collections.emptyMap()); TargetClusterResourceProvider provider = new TargetClusterResourceProvider(service); Set<Resource> resources = provider.getResources(request, null); Assert.assertEquals(3, resources.size()); verify(service); }