/** getTokenFromProvider */
  @Test
  public void testGetTokenFromProvider() throws Exception {
    final ByteArrayInputStream in =
        new ByteArrayInputStream(
            "oauth_token=mytoken&oauth_token_secret=mytokensecret".getBytes("UTF-8"));
    CoreOAuthConsumerSupport support =
        new CoreOAuthConsumerSupport() {
          @Override
          protected InputStream readResource(
              ProtectedResourceDetails details,
              URL url,
              String httpMethod,
              OAuthConsumerToken token,
              Map<String, String> additionalParameters,
              Map<String, String> additionalRequestHeaders) {
            return in;
          }
        };

    ProtectedResourceDetails details = createMock(ProtectedResourceDetails.class);
    URL url = new URL("https://myhost.com/somepath?with=some&query=params&too");

    expect(details.getId()).andReturn("resourceId");
    replay(details);
    OAuthConsumerToken token = support.getTokenFromProvider(details, url, "POST", null, null);
    verify(details);
    reset(details);
    assertFalse(token.isAccessToken());
    assertEquals("mytoken", token.getValue());
    assertEquals("mytokensecret", token.getSecret());
    assertEquals("resourceId", token.getResourceId());
  }