@Test public void execute_yieldsTokenResponseWithCorrectData() throws IOException { CloseableHttpResponse response = HttpClientTestFactory.createHttpResponse(VALID_JSON_RESPONSE); when(mockHttpClient.execute(any(HttpPost.class))).thenReturn(response); OAuth2TokenResponse re = requestAccessToken(emptyMap()); assertThat(re.getAccessToken()).isEqualTo(ACCESS_TOKEN); assertThat(re.getRefreshToken()).isEqualTo(REFRESH_TOKEN); assertThat(re.getExpiredAt()).isAfter(Instant.now()); }
@Override protected OAuth2TokenResponse requestAccessToken(URI tokenEndpointUri, HttpHeaders headers, Map<String, String> parameters) throws OAuth2ServiceException { HttpPost httpPost = createHttpPost(tokenEndpointUri, headers, parameters); return executeRequest(httpPost); }
DefaultOAuth2TokenService extends AbstractOAuth2TokenService { @Override protected OAuth2TokenResponse requestAccessToken(URI tokenEndpointUri, HttpHeaders headers, Map<String, String> parameters) throws OAuth2ServiceException { HttpPost httpPost = createHttpPost(tokenEndpointUri, headers, parameters); return executeRequest(httpPost); } }
DefaultOAuth2TokenService extends AbstractOAuth2TokenService { @Override protected OAuth2TokenResponse requestAccessToken(URI tokenEndpointUri, HttpHeaders headers, Map<String, String> parameters) throws OAuth2ServiceException { HttpPost httpPost = createHttpPost(tokenEndpointUri, headers, parameters); return executeRequest(httpPost); } DefaultOAuth2TokenService();  DefaultOAuth2TokenService(@Nonnull CloseableHttpClient httpClient);  DefaultOAuth2TokenService(@Nonnull TokenCacheConfiguration tokenCacheConfiguration);  DefaultOAuth2TokenService(@Nonnull CloseableHttpClient httpClient,
			@Nonnull TokenCacheConfiguration tokenCacheConfiguration); }
DefaultOAuth2TokenService extends AbstractOAuth2TokenService { @Override protected OAuth2TokenResponse requestAccessToken(URI tokenEndpointUri, HttpHeaders headers, Map<String, String> parameters) throws OAuth2ServiceException { HttpPost httpPost = createHttpPost(tokenEndpointUri, headers, parameters); return executeRequest(httpPost); } DefaultOAuth2TokenService();  DefaultOAuth2TokenService(@Nonnull CloseableHttpClient httpClient);  DefaultOAuth2TokenService(@Nonnull TokenCacheConfiguration tokenCacheConfiguration);  DefaultOAuth2TokenService(@Nonnull CloseableHttpClient httpClient,
			@Nonnull TokenCacheConfiguration tokenCacheConfiguration);  }
DefaultOAuth2TokenService extends AbstractOAuth2TokenService { @Override protected OAuth2TokenResponse requestAccessToken(URI tokenEndpointUri, HttpHeaders headers, Map<String, String> parameters) throws OAuth2ServiceException { HttpPost httpPost = createHttpPost(tokenEndpointUri, headers, parameters); return executeRequest(httpPost); } DefaultOAuth2TokenService();  DefaultOAuth2TokenService(@Nonnull CloseableHttpClient httpClient);  DefaultOAuth2TokenService(@Nonnull TokenCacheConfiguration tokenCacheConfiguration);  DefaultOAuth2TokenService(@Nonnull CloseableHttpClient httpClient,
			@Nonnull TokenCacheConfiguration tokenCacheConfiguration);   }