@Test(expected = OAuthException.class) public void testCase2() throws OAuthException, IOException, JSONException { FacebookAccessTokenClientResource tokenResource = new FacebookAccessTokenClientResource(new Reference(baseURI, "/oauth/token2")); tokenResource.setClientCredentials(STUB_CLIENT_ID, STUB_CLIENT_SECRET); tokenResource.requestToken(new OAuthParameters()); fail("OAuthException is expected."); }
@Test public void testCase1() throws OAuthException, IOException, JSONException { FacebookAccessTokenClientResource tokenResource = new FacebookAccessTokenClientResource(new Reference(baseURI, "/oauth/token1")); tokenResource.setClientCredentials(STUB_CLIENT_ID, STUB_CLIENT_SECRET); Token token = tokenResource.requestToken(new OAuthParameters()); assertThat(token.getAccessToken(), is("foo")); assertThat(token.getExpirePeriod(), is(3600)); }