public LowLevelHttpResponse execute() throws IOException {
MockLowLevelHttpResponse response = new MockLowLevelHttpResponse();
response.setContentType("UTF-8");
GenericData responseData;
if (error) {
TokenErrorResponse json = new TokenErrorResponse();
json.setError("invalid_client");
responseData = json;
response.setStatusCode(400);
} else {
TokenResponse json = new TokenResponse();
json.setAccessToken(NEW_ACCESS_TOKEN);
json.setRefreshToken(NEW_REFRESH_TOKEN);
json.setExpiresInSeconds(EXPIRES_IN);
responseData = json;
}
response.setContent(JSON_FACTORY.toString(responseData));
return response;
}