public static SamlRegisteredService getSamlRegisteredService(final String serviceId) {
        val registeredService = new SamlRegisteredService();
        registeredService.setId(RandomUtils.nextInt());
        registeredService.setName("SAML");
        registeredService.setServiceId(serviceId);
        registeredService.setMetadataLocation("classpath:metadata/testshib-providers.xml");

        val request = new MockHttpServletRequest();
        request.addParameter(SamlProtocolConstants.PARAMETER_ENTITY_ID, registeredService.getServiceId());
        request.addHeader(HttpHeaders.USER_AGENT, "Mozilla/5.0 (Windows NT 10.0; WOW64)");
        RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request, new MockHttpServletResponse()));
        return registeredService;
    }
Gets saml registered service.

@param serviceId the service id
@return the saml registered service
support/cas-server-support-saml-idp/src/test/java/org/apereo/cas/support/saml/SamlIdPTestUtils.java