private static void assertFilterExists(@Nonnull QuickLinksProfile profile,
                                         @Nullable String serviceName,
                                         @Nullable String componentName,
                                         @Nonnull Filter filter) {
    // looking for a global filter
    if (null == serviceName) {
      if (!profile.getFilters().contains(filter)) {
        throw new AssertionError("Expected global filter not found: " + filter);
      }
    }
    // looking for a filter defined on service or component level
    else {
      Service service = findService(profile.getServices(), serviceName);
      // looking for a filter defined on service level
      if (null == componentName) {
        if (!service.getFilters().contains(filter)) {
          throw new AssertionError(String.format("Expected filter not found. Service: %s, Filter: %s",
              serviceName, filter));
        }
      }
      // looking for a filter defined on component level
      else {
        Component component = findComponent(service.getComponents(), componentName);
        if (!component.getFilters().contains(filter)) {
          throw new AssertionError(String.format("Expected filter not found. Service: %s, Component: %s, Filter: %s",
              serviceName, componentName, filter));
        }
      }
    }
  }
Verifies that the filter specified by the arguments exists in the received {@link QuickLinksProfile}
@param profile the {@link QuickLinksProfile} to examine
@param serviceName the service name where the filter is defined. {@code null} means the searched filter is a global
                   filter
@param componentName the component name where the filter is defined. Only makes sense when serviceName is defined
                   too. {@code null} means the searched filter is a service level filter, not component level one.
                   filter
@param filter the {@link Filter} to look for.
ambari-server/src/test/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileBuilderTest.java