public int checkUpgradeTypes(Set<Resource> resources, Map<String, List<UpgradeType>> versionToUpgradeTypesMap) {
    int count = 0;
    Iterator<Resource> itr = resources.iterator();
    while (itr.hasNext()) {
      Resource res = itr.next();
      Map<String, Map<String, Object>> resPropMap = res.getPropertiesMap();
      for (String resource : resPropMap.keySet()) {
        Map<String, Object> propMap = resPropMap.get(resource);
        String stackVersion = propMap.get("stack_version").toString();
        if (versionToUpgradeTypesMap.containsKey(stackVersion)) {
          List<UpgradeType> upgradeTypes = new ArrayList<>((Set<UpgradeType>)propMap.get("upgrade_types"));
          List<UpgradeType> expectedTypes = versionToUpgradeTypesMap.get(stackVersion);
          Collections.sort(upgradeTypes);
          Collections.sort(expectedTypes);

          assertEquals(expectedTypes, upgradeTypes);
          count++;
        }
      }
    }
    return count;
  }
Checks for UpgradeTypes for the specified Target stack versions.

@param resources                The resource Set to iterate over
@param versionToUpgradeTypesMap Contains 'Stack version' to 'Upgrade Type' Map.
@return count, 0 or number of Stack version's Upgrade Type(s) correctly compared.
ambari-server/src/test/java/org/apache/ambari/server/controller/internal/CompatibleRepositoryVersionResourceProviderTest.java