### Question:
InstanceResourceProvider extends AbstractDRResourceProvider { @Override public Set<Resource> getResources(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { Set<String> requestedIds = getRequestPropertyIds(request, predicate); Set<Resource> resources = new HashSet<>(); List<String> feedNames = new LinkedList<>(); IvoryService service = getService(); if (predicate == null) { feedNames = service.getFeedNames(); } else { for (Map<String, Object> propertyMap : getPropertyMaps(predicate)) { String feedName = (String) propertyMap.get(INSTANCE_FEED_NAME_PROPERTY_ID); if (feedName == null) { feedNames = service.getFeedNames(); break; } feedNames.add(feedName); } } for (String feedName : feedNames) { List<Instance> instances = service.getInstances(feedName); for (Instance instance : instances) { Resource resource = new ResourceImpl(Resource.Type.DRInstance); setResourceProperty(resource, INSTANCE_FEED_NAME_PROPERTY_ID, instance.getFeedName(), requestedIds); setResourceProperty(resource, INSTANCE_ID_PROPERTY_ID, instance.getId(), requestedIds); setResourceProperty(resource, INSTANCE_STATUS_PROPERTY_ID, instance.getStatus(), requestedIds); setResourceProperty(resource, INSTANCE_START_TIME_PROPERTY_ID, instance.getStartTime(), requestedIds); setResourceProperty(resource, INSTANCE_END_TIME_PROPERTY_ID, instance.getEndTime(), requestedIds); setResourceProperty(resource, INSTANCE_DETAILS_PROPERTY_ID, instance.getDetails(), requestedIds); setResourceProperty(resource, INSTANCE_LOG_PROPERTY_ID, instance.getLog(), requestedIds); if (predicate == null || predicate.evaluate(resource)) { resources.add(resource); } } } return resources; } InstanceResourceProvider(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<Instance> instances = new LinkedList<>(); Instance instance1 = new Instance("Feed1", "Instance1", "s", "st", "et", "d", "l"); Instance instance2 = new Instance("Feed1", "Instance2", "s", "st", "et", "d", "l"); Instance instance3 = new Instance("Feed1", "Instance3", "s", "st", "et", "d", "l"); instances.add(instance1); instances.add(instance2); instances.add(instance3); expect(service.getFeedNames()).andReturn(Collections.singletonList("Feed1")); expect(service.getInstances("Feed1")).andReturn(instances); replay(service); propertySet.add(properties); Request request = PropertyHelper.getCreateRequest(propertySet, Collections.emptyMap()); InstanceResourceProvider provider = new InstanceResourceProvider(service); Set<Resource> resources = provider.getResources(request, null); Assert.assertEquals(3, resources.size()); verify(service); }