    @Test
    public void testGetToken() {

        final Authentication userAuthentication = mock(Authentication.class);
        when(userAuthentication.getDetails()).thenReturn(singletonMap(ACCESS_TOKEN, "1234567890"));

        SecurityContextHolder.getContext().setAuthentication(new OAuth2Authentication(mock(OAuth2Request.class),
                userAuthentication));
        assertThat(getAccessTokenFromSecurityContext().get()).contains("1234567890");
    }