OAuth1aParameters { String constructSignatureBase(String nonce, String timestamp) { final URI uri = URI.create(url); final TreeMap<String, String> params = UrlUtils.getQueryParams(uri, true); if (postParams != null) { params.putAll(postParams); } if (callback != null) { params.put(OAuthConstants.PARAM_CALLBACK, callback); } params.put(OAuthConstants.PARAM_CONSUMER_KEY, authConfig.getConsumerKey()); params.put(OAuthConstants.PARAM_NONCE, nonce); params.put(OAuthConstants.PARAM_SIGNATURE_METHOD, SIGNATURE_METHOD); params.put(OAuthConstants.PARAM_TIMESTAMP, timestamp); if (authToken != null && authToken.token != null) { params.put(OAuthConstants.PARAM_TOKEN, authToken.token); } params.put(OAuthConstants.PARAM_VERSION, VERSION); final String baseUrl = uri.getScheme() + ": final StringBuilder sb = new StringBuilder() .append(method.toUpperCase(Locale.ENGLISH)) .append('&') .append(UrlUtils.percentEncode(baseUrl)) .append('&') .append(getEncodedQueryParams(params)); return sb.toString(); } OAuth1aParameters(TwitterAuthConfig authConfig, TwitterAuthToken authToken,
            String callback, String method, String url, Map<String, String> postParams); String getAuthorizationHeader();  }
@Test public void testConstructSignatureBase() { for (TestParameters testParameters : TEST_PARAMETERS) { final OAuth1aParameters oAuth1aParameters = toOAuth1aParameters(testParameters); final String signatureBase = oAuth1aParameters.constructSignatureBase( testParameters.nonce, testParameters.timestamp); assertEquals(testParameters.expectedSignatureBase, signatureBase); } }