@Test public void emptyResponse_throwsException() throws IOException { CloseableHttpResponse response = HttpClientTestFactory.createHttpResponse("{}"); when(mockHttpClient.execute(any(HttpPost.class))).thenReturn(response); assertThatThrownBy(() -> requestAccessToken(emptyMap())) .isInstanceOf(OAuth2ServiceException.class) .hasMessageContaining("expires_in"); }
@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);   }