@Test(expected = IllegalStateException.class) public void shouldThrowAnIllegalStateExceptionWhenTryingToRefreshTokenIfNoOAuthApiHasBeenPassed() throws Exception { OAuthorization toTest = new OAuthorization(mockToken, mockOAuthenticator); toTest.refresh(); }
public void refresh() throws Exception{ State.notNull(oauthApi, "AccessToken refresh impossible, you must specify the oauth_session_handle and refresh access token url, see CRestBuilder."); this.accessOAuthToken = oauthApi.refreshAccessToken(this.accessOAuthToken); }
OAuthorization implements Authorization { public void refresh() throws Exception{ State.notNull(oauthApi, "AccessToken refresh impossible, you must specify the oauth_session_handle and refresh access token url, see CRestBuilder."); this.accessOAuthToken = oauthApi.refreshAccessToken(this.accessOAuthToken); } }
OAuthorization implements Authorization { public void refresh() throws Exception{ State.notNull(oauthApi, "AccessToken refresh impossible, you must specify the oauth_session_handle and refresh access token url, see CRestBuilder."); this.accessOAuthToken = oauthApi.refreshAccessToken(this.accessOAuthToken); } OAuthorization(OAuthToken accessOAuthToken, OAuthenticator oauth);  OAuthorization(OAuthToken accessOAuthToken, OAuthenticator oauth, OAuthApi oauthApi); }
OAuthorization implements Authorization { public void refresh() throws Exception{ State.notNull(oauthApi, "AccessToken refresh impossible, you must specify the oauth_session_handle and refresh access token url, see CRestBuilder."); this.accessOAuthToken = oauthApi.refreshAccessToken(this.accessOAuthToken); } OAuthorization(OAuthToken accessOAuthToken, OAuthenticator oauth);  OAuthorization(OAuthToken accessOAuthToken, OAuthenticator oauth, OAuthApi oauthApi); AuthorizationToken authorize(MethodType methodType, String url, EncodedPair... parameters); void refresh(); }
OAuthorization implements Authorization { public void refresh() throws Exception{ State.notNull(oauthApi, "AccessToken refresh impossible, you must specify the oauth_session_handle and refresh access token url, see CRestBuilder."); this.accessOAuthToken = oauthApi.refreshAccessToken(this.accessOAuthToken); } OAuthorization(OAuthToken accessOAuthToken, OAuthenticator oauth);  OAuthorization(OAuthToken accessOAuthToken, OAuthenticator oauth, OAuthApi oauthApi); AuthorizationToken authorize(MethodType methodType, String url, EncodedPair... parameters); void refresh();  }