@Test
public void testException() {
HttpRequest req = new HttpRequest(Uri.parse("http://www"));
HttpResponse ok = new HttpResponseBuilder().setHttpStatusCode(200).create();
params.addRequestTrace(req, ok);
OAuthRequestException e = params.oauthRequestException("error", "errorText");
checkStringContains(e.toString(), "[error,errorText]");
params.addRequestTrace(null, null);
Throwable cause = new RuntimeException();
e = params.oauthRequestException(OAuthError.UNAUTHENTICATED, "errorText", cause);
checkStringContains(e.toString(), "[UNAUTHENTICATED,errorText]");
assertEquals(cause, e.getCause());
}