protected OAuth20AccessToken getAccessToken(final Principal principal, final String idToken,
                                                final String clientId) throws Throwable {
        val code = addCode(principal, getOidcRegisteredService(clientId));
        val accessToken = mock(OAuth20AccessToken.class);
        when(accessToken.getAuthentication()).thenReturn(RegisteredServiceTestUtils.getAuthentication(principal));
        val service = RegisteredServiceTestUtils.getService("https://oauth.example.org");
        when(accessToken.getService()).thenReturn(service);
        when(accessToken.getId()).thenReturn("AT-" + UUID.randomUUID());
        when(accessToken.getExpirationPolicy()).thenReturn(NeverExpiresExpirationPolicy.INSTANCE);
        when(accessToken.getTicketGrantingTicket()).thenReturn(new MockTicketGrantingTicket("casuser"));
        when(accessToken.getClientId()).thenReturn(clientId);
        when(accessToken.getCreationTime()).thenReturn(ZonedDateTime.now(ZoneOffset.UTC));
        when(accessToken.getScopes()).thenReturn(Set.of(OidcConstants.StandardScopes.EMAIL.getScope(),
            OidcConstants.StandardScopes.PROFILE.getScope(),
            OidcConstants.StandardScopes.OPENID.getScope()));
        when(accessToken.getToken()).thenReturn(code.getId());
        when(accessToken.getIdToken()).thenReturn(idToken);
        when(accessToken.getExpiresIn()).thenReturn(Duration.ofDays(365 * 5).toSeconds());
        when(accessToken.getGrantType()).thenReturn(OAuth20GrantTypes.AUTHORIZATION_CODE);
        when(accessToken.getPrefix()).thenReturn(OAuth20AccessToken.PREFIX);
        return accessToken;
    }
This is {@link AbstractOidcTests}.

@author Misagh Moayyed
@since 5.3.0
support/cas-server-support-oidc/src/test/java/org/apereo/cas/oidc/AbstractOidcTests.java