expect(request.getParameterMap()).andStubReturn(parameters);
replay(request);
OAuthAuthzResponse r = null;
try {
r = OAuthAuthzResponse.oauthTokenAuthzResponse(request);
} catch (OAuthProblemException e) {
fail("Exception not expected");
}
String token = r.getAccessToken();
Assert.assertNotNull(token);
verify(request);
reset(request);
//both parameters code and access token
TestUtils.expectNoErrorParameters(request);
parameters.put(OAuth.OAUTH_CODE, new String[] {"code"});
parameters.put(OAuth.OAUTH_ACCESS_TOKEN, null);
parameters.put(OAuth.OAUTH_SCOPE, null);
parameters.put(OAuth.OAUTH_EXPIRES_IN, null);
expect(request.getParameterMap()).andReturn(parameters);
replay(request);
r = OAuthAuthzResponse.oauthCodeAuthzResponse(request);
token = r.getAccessToken();
Assert.assertNull(token);
verify(request);
reset(request);