### Question:
ExtensionResourceProvider extends ReadOnlyResourceProvider { @Override public Set<Resource> getResources(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { final Set<ExtensionRequest> requests = new HashSet<>(); if (predicate == null) { requests.add(getRequest(Collections.emptyMap())); } else { for (Map<String, Object> propertyMap : getPropertyMaps(predicate)) { requests.add(getRequest(propertyMap)); } } Set<String> requestedIds = getRequestPropertyIds(request, predicate); Set<ExtensionResponse> responses = getResources(new Command<Set<ExtensionResponse>>() { @Override public Set<ExtensionResponse> invoke() throws AmbariException { return getManagementController().getExtensions(requests); } }); Set<Resource> resources = new HashSet<>(); for (ExtensionResponse response : responses) { Resource resource = new ResourceImpl(Resource.Type.Extension); setResourceProperty(resource, EXTENSION_NAME_PROPERTY_ID, response.getExtensionName(), requestedIds); resource.setProperty(EXTENSION_NAME_PROPERTY_ID, response.getExtensionName()); resources.add(resource); } return resources; } protected  ExtensionResourceProvider(AmbariManagementController managementController); @Override Set<Resource> getResources(Request request, Predicate predicate); @Override RequestStatus updateResources(Request request, Predicate predicate); static final String EXTENSION_NAME_PROPERTY_ID; }### Answer:
@Test public void testGetResources() throws Exception { Resource.Type type = Resource.Type.Extension; AmbariManagementController managementController = createMock(AmbariManagementController.class); Set<ExtensionResponse> allResponse = new HashSet<>(); allResponse.add(new ExtensionResponse("Extension1")); allResponse.add(new ExtensionResponse("Extension2")); expect(managementController.getExtensions(EasyMock.anyObject())).andReturn(allResponse).once(); replay(managementController); ResourceProvider provider = AbstractControllerResourceProvider.getResourceProvider( type, managementController); Set<String> propertyIds = new HashSet<>(); propertyIds.add(ExtensionResourceProvider.EXTENSION_NAME_PROPERTY_ID); Request request = PropertyHelper.getReadRequest(propertyIds); Set<Resource> resources = provider.getResources(request, null); Assert.assertEquals(2, resources.size()); Set<String> extensionNames = new HashSet<>(); extensionNames.add("Extension1"); extensionNames.add("Extension2"); for (Resource resource : resources) { String extensionName = (String) resource.getPropertyValue(ExtensionResourceProvider.EXTENSION_NAME_PROPERTY_ID); Assert.assertTrue(extensionNames.contains(extensionName)); } verify(managementController); }