OAuth1aParameters { String constructAuthorizationHeader(String nonce, String timestamp, String signature) { final StringBuilder sb = new StringBuilder("OAuth"); appendParameter(sb, OAuthConstants.PARAM_CALLBACK, callback); appendParameter(sb, OAuthConstants.PARAM_CONSUMER_KEY, authConfig.getConsumerKey()); appendParameter(sb, OAuthConstants.PARAM_NONCE, nonce); appendParameter(sb, OAuthConstants.PARAM_SIGNATURE, signature); appendParameter(sb, OAuthConstants.PARAM_SIGNATURE_METHOD, SIGNATURE_METHOD); appendParameter(sb, OAuthConstants.PARAM_TIMESTAMP, timestamp); final String token = authToken != null ? authToken.token : null; appendParameter(sb, OAuthConstants.PARAM_TOKEN, token); appendParameter(sb, OAuthConstants.PARAM_VERSION, VERSION); return sb.substring(0, sb.length() - 1); } OAuth1aParameters(TwitterAuthConfig authConfig, TwitterAuthToken authToken,
            String callback, String method, String url, Map<String, String> postParams); String getAuthorizationHeader();  }
@Test public void testConstructAuthorizationHeader() { for (TestParameters testParameters : TEST_PARAMETERS) { final OAuth1aParameters oAuth1aParameters = toOAuth1aParameters(testParameters); final String authHeader = oAuth1aParameters.constructAuthorizationHeader( testParameters.nonce, testParameters.timestamp, testParameters.expectedSignature); assertEquals(testParameters.expectedAuthHeader, authHeader); } }