### Question:
AlertDefinitionResourceProvider extends AbstractControllerResourceProvider { @Override public Set<Resource> getResources(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { Set<String> requestPropertyIds = getRequestPropertyIds(request, predicate); Set<Resource> results = new LinkedHashSet<>(); for (Map<String, Object> propertyMap : getPropertyMaps(predicate)) { String clusterName = (String) propertyMap.get(ALERT_DEF_CLUSTER_NAME); if (null == clusterName || clusterName.isEmpty()) { throw new IllegalArgumentException("Invalid argument, cluster name is required"); } String id = (String) propertyMap.get(ALERT_DEF_ID); if (null != id) { AlertDefinitionEntity entity = alertDefinitionDAO.findById(Long.parseLong(id)); if (null != entity) { AlertResourceProviderUtils.verifyViewAuthorization(entity); results.add(toResource(clusterName, entity, requestPropertyIds)); } } else { Cluster cluster = null; try { cluster = getManagementController().getClusters().getCluster(clusterName); } catch (AmbariException e) { throw new NoSuchResourceException("Parent Cluster resource doesn't exist", e); } List<AlertDefinitionEntity> entities = alertDefinitionDAO.findAll(cluster.getClusterId()); boolean serviceLevelAuthorization = AlertResourceProviderUtils.hasViewAuthorization("_SERVICE_NAME_", cluster.getResourceId()); boolean clusterLevelAuthorization = AlertResourceProviderUtils.hasViewAuthorization("", cluster.getResourceId()); for (AlertDefinitionEntity entity : entities) { String serviceName = entity.getServiceName(); if((StringUtils.isEmpty(serviceName) || "AMBARI".equals(serviceName)) ? clusterLevelAuthorization : serviceLevelAuthorization) { results.add(toResource(clusterName, entity, requestPropertyIds)); } } } } return results; } AlertDefinitionResourceProvider(AmbariManagementController controller); @Override RequestStatus createResources(final 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 testGetResourcesNoPredicate() throws Exception { AlertDefinitionResourceProvider provider = createProvider(null); Request request = PropertyHelper.getReadRequest("AlertDefinition/cluster_name", "AlertDefinition/id"); Set<Resource> results = provider.getResources(request, null); assertEquals(0, results.size()); }