private static RegisteredService newService(final String id) {
        val service = new CasRegisteredService();
        service.setServiceId(id);
        service.setName(UUID.randomUUID().toString());
        service.setId(RandomUtils.nextLong());
        service.setLogoutType(RegisteredServiceLogoutType.FRONT_CHANNEL);
        service.setServiceTicketExpirationPolicy(
            new DefaultRegisteredServiceServiceTicketExpirationPolicy(100, "100"));
        service.setProxyTicketExpirationPolicy(
            new DefaultRegisteredServiceProxyTicketExpirationPolicy(100, "100"));
        val policy = new ChainingRegisteredServiceSingleSignOnParticipationPolicy();
        policy.addPolicies(Arrays.asList(
            new LastUsedTimeRegisteredServiceSingleSignOnParticipationPolicy(TimeUnit.SECONDS, 100, 1),
            new AuthenticationDateRegisteredServiceSingleSignOnParticipationPolicy(TimeUnit.SECONDS, 100, 1)));
        service.setSingleSignOnParticipationPolicy(policy);

        val consent = new DefaultRegisteredServiceConsentPolicy(CollectionUtils.wrapSet("attr1", "attr2"),
            CollectionUtils.wrapSet("ex-attr1", "ex-attr2"));
        consent.setStatus(TriStateBoolean.TRUE);

        val attrPolicy = new ReturnAllowedAttributeReleasePolicy();
        attrPolicy.setConsentPolicy(consent);
        service.setAttributeReleasePolicy(attrPolicy);
        return service;
    }
Unit test for {@link CasRegisteredService}.

@author Marvin S. Addison
@since 3.4.0
core/cas-server-core-services/src/test/java/org/apereo/cas/services/CasRegisteredServiceTests.java