protected static OAuthRegisteredService getRegisteredService(final String serviceId,
                                                                 final String clientId,
                                                                 final String secret,
                                                                 final Set<OAuth20GrantTypes> grantTypes) {
        val service = new OAuthRegisteredService();
        service.setName("RegisteredService-" + RandomUtils.randomAlphabetic(6));
        service.setServiceId(serviceId);
        service.setClientId(clientId);
        service.setClientSecret(secret);
        service.setAttributeReleasePolicy(new ReturnAllAttributeReleasePolicy());
        val types = grantTypes.stream().map(OAuth20GrantTypes::getType).collect(Collectors.toSet());
        service.setSupportedGrantTypes(types);
        return service;
    }
This is {@link AbstractOAuth20Tests}.

@author Misagh Moayyed
@since 5.0.0
support/cas-server-support-oauth/src/test/java/org/apereo/cas/AbstractOAuth20Tests.java