public ClientAccessToken doReadClientAccessToken(String response,
String expectedTokenType,
Map<String, String> expectedParams) throws Exception {
OAuthJSONProvider provider = new OAuthJSONProvider();
ClientAccessToken token = (ClientAccessToken)provider.readFrom((Class)ClientAccessToken.class,
ClientAccessToken.class,
new Annotation[]{},
MediaType.APPLICATION_JSON_TYPE,
new MetadataMap<String, String>(),
new ByteArrayInputStream(response.getBytes()));
assertEquals("1234", token.getTokenKey());
assertEquals(expectedTokenType, token.getTokenType());
assertEquals("5678", token.getRefreshToken());
assertEquals(12345, token.getExpiresIn());
assertEquals("read", token.getApprovedScope());
Map<String, String> extraParams = token.getParameters();
if (expectedParams != null) {
assertEquals(expectedParams, extraParams);
}
assertEquals("http://abc", extraParams.get("my_parameter"));