@Test
        void verifyDeviceFlowGeneratesCode() throws Throwable {
            val service = addRegisteredService();
            val mockRequest = new MockHttpServletRequest(HttpMethod.GET.name(), CONTEXT + OAuth20Constants.ACCESS_TOKEN_URL);
            mockRequest.setParameter(OAuth20Constants.CLIENT_ID, service.getClientId());
            mockRequest.setParameter(OAuth20Constants.RESPONSE_TYPE, OAuth20ResponseTypes.DEVICE_CODE.getType());
            val mockResponse = new MockHttpServletResponse();

            val commonProfile = new CommonProfile();
            commonProfile.setId("testuser");
            new ProfileManager(new JEEContext(mockRequest, mockResponse), oauthDistributedSessionStore)
                .save(true, commonProfile, false);

            requiresAuthenticationInterceptor.preHandle(mockRequest, mockResponse, null);
            val mv = accessTokenController.handleRequest(mockRequest, mockResponse);
            val model = mv.getModel();
            assertTrue(model.containsKey(OAuth20Constants.DEVICE_CODE));
            assertTrue(model.containsKey(OAuth20Constants.DEVICE_VERIFICATION_URI));
            assertTrue(model.containsKey(OAuth20Constants.DEVICE_USER_CODE));
            assertTrue(model.containsKey(OAuth20Constants.DEVICE_INTERVAL));
            assertTrue(model.containsKey(OAuth20Constants.EXPIRES_IN));

            val devCode = model.get(OAuth20Constants.DEVICE_CODE).toString();
            val userCode = model.get(OAuth20Constants.DEVICE_USER_CODE).toString();

            val devReq = new MockHttpServletRequest(HttpMethod.GET.name(), CONTEXT + OAuth20Constants.DEVICE_AUTHZ_URL);
            devReq.setParameter(OAuth20DeviceUserCodeApprovalEndpointController.PARAMETER_USER_CODE, userCode);
            val devResp = new MockHttpServletResponse();
            val mvDev = deviceController.handlePostRequest(devReq, devResp);
            assertNotNull(mvDev);
            val status = mvDev.getStatus();
            assertNotNull(status);
            assertTrue(status.is2xxSuccessful());

            mockRequest.setParameter(OAuth20Constants.CLIENT_ID, service.getClientId());
            mockRequest.setParameter(OAuth20Constants.RESPONSE_TYPE, OAuth20ResponseTypes.DEVICE_CODE.getType());
            mockRequest.setParameter(OAuth20Constants.DEVICE_CODE, devCode);
            val approveResp = new MockHttpServletResponse();
            requiresAuthenticationInterceptor.preHandle(mockRequest, approveResp, null);
            val mvApproved = accessTokenController.handleGetRequest(mockRequest, approveResp);
            assertTrue(mvApproved.getModel().containsKey(OAuth20Constants.ACCESS_TOKEN));
            assertEquals(getDefaultAccessTokenExpiration(), mvApproved.getModel().get(OAuth20Constants.EXPIRES_IN));
            assertTrue(mvApproved.getModel().containsKey(OAuth20Constants.TOKEN_TYPE));
        }
Check the registered services always contain empty allowed grant types.
These tests are run to ensure that
the change that adds proper support for supported grant types does not break existing CAS
setups that does not specify allowed grant types. Briefly, it checks that empty  supported grant types
is equivalent to supported grant types with all valid values.

@return stream of services for tests
support/cas-server-support-oauth/src/test/java/org/apereo/cas/support/oauth/web/endpoints/OAuth20AccessTokenEndpointControllerTests.java