@Test
  public void testUrlOverride() throws Exception {
    Component nameNode = Component.create(
      NAMENODE,
      ImmutableList.of(
        Filter.linkNameFilter(NAMENODE_UI, true),
        Filter.linkNameFilter(NAMENODE_LOGS, LINK_URL_1, true)));
    Service hdfs = Service.create(
      HDFS,
      ImmutableList.of(Filter.linkNameFilter(NAMENODE_JMX, LINK_URL_2, true)),
      ImmutableList.of(nameNode));
    QuickLinksProfile profile = QuickLinksProfile.create(
      ImmutableList.of(Filter.linkNameFilter(THREAD_STACKS, LINK_URL_3, true)),
      ImmutableList.of(hdfs));

    DefaultQuickLinkVisibilityController evaluator = new DefaultQuickLinkVisibilityController(profile);
    assertEquals(Optional.empty(), evaluator.getUrlOverride(HDFS, namenodeUi));
    assertEquals(Optional.of(LINK_URL_1), evaluator.getUrlOverride(HDFS, namenodeLogs));
    assertEquals(Optional.of(LINK_URL_2), evaluator.getUrlOverride(HDFS, namenodeJmx));
    // component name doesn't matter
    namenodeLogs.setComponentName(null);
    assertEquals(Optional.of(LINK_URL_1), evaluator.getUrlOverride(HDFS, namenodeLogs));
    // no override for links not in the profile
    assertEquals(Optional.empty(), evaluator.getUrlOverride(YARN, link("resourcemanager_ui", "RESOURCEMANAGER", null)));
    // url overrides in global filters are ignored
    assertEquals(Optional.empty(), evaluator.getUrlOverride(HDFS, threadStacks));
  }
Test to prove that the link is hidden if no filters apply.
ambari-server/src/test/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinkVisibilityControllerTest.java