@Test
    void verifyLocate() {
        val entity = mock(EntityDescriptor.class);

        val request = new MockHttpServletRequest();
        val id = UUID.randomUUID().toString();
        val service = RegisteredServiceTestUtils.getRegisteredService();
        var mdui = MetadataUIUtils.locateMetadataUserInterfaceForEntityId(entity, id, service, request);
        assertNotNull(mdui);

        val sp = mock(SPSSODescriptor.class);
        when(entity.getSPSSODescriptor(anyString())).thenReturn(sp);
        mdui = MetadataUIUtils.locateMetadataUserInterfaceForEntityId(entity, id, service, request);
        assertNotNull(mdui);

        val extensions = mock(Extensions.class);
        when(sp.getExtensions()).thenReturn(extensions);
        mdui = MetadataUIUtils.locateMetadataUserInterfaceForEntityId(entity, id, service, request);
        assertNotNull(mdui);

        val info = mock(UIInfo.class);
        val displayName = mock(DisplayName.class);
        when(displayName.getValue()).thenReturn("CAS");
        when(info.getDisplayNames()).thenReturn(List.of(displayName));
        when(extensions.getUnknownXMLObjects(any())).thenReturn(List.of(info));
        mdui = MetadataUIUtils.locateMetadataUserInterfaceForEntityId(entity, id, service, request);
        assertNotNull(mdui);
        assertEquals("CAS", mdui.getDisplayName());
    }
This is {@link MetadataUIUtilsTests}.

@author Misagh Moayyed
@since 6.2.0
support/cas-server-support-saml-mdui-core/src/test/java/org/apereo/cas/support/saml/mdui/MetadataUIUtilsTests.java