public static OAuthRegisteredService getService(final String serviceId,
                                                    final String name,
                                                    final String clientId,
                                                    final String clientSecret,
                                                    final Set<OAuth20GrantTypes> grantTypes) {
        val registeredService = new OAuthRegisteredService();
        registeredService.setName(name);
        registeredService.setClientId(clientId);
        registeredService.setClientSecret(clientSecret);
        registeredService.setServiceId(serviceId);
        registeredService.setSupportedGrantTypes(grantTypes.stream()
            .map(OAuth20GrantTypes::getType)
            .collect(Collectors.toSet()));
        return registeredService;
    }
Some utils for creating test services for request validator testing.

@author Kirill Gagarski
@since 5.3.3
support/cas-server-support-oauth/src/test/java/org/apereo/cas/support/oauth/validator/token/RequestValidatorTestUtils.java