@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 = new OAuthRequestException("error", "errorText"); checkStringContains(e.toString(), "[error,errorText]"); params.addRequestTrace(null, null); Throwable cause = new RuntimeException(); e = new OAuthRequestException(OAuthError.UNAUTHENTICATED, "errorText", cause); checkStringContains(e.toString(), "[UNAUTHENTICATED,Unauthenticated OAuth fetch]"); assertEquals(cause, e.getCause()); }
@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 = new OAuthRequestException("error", "errorText"); checkStringContains(e.toString(), "[error,errorText]"); params.addRequestTrace(null, null); Throwable cause = new RuntimeException(); e = new OAuthRequestException(OAuthError.UNAUTHENTICATED, "errorText", cause); checkStringContains(e.toString(), "[UNAUTHENTICATED,Unauthenticated OAuth fetch]"); assertEquals(cause, e.getCause()); }
@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 = new OAuthRequestException("error", "errorText"); checkStringContains(e.toString(), "[error,errorText]"); params.addRequestTrace(null, null); Throwable cause = new RuntimeException(); e = new OAuthRequestException(OAuthError.UNAUTHENTICATED, "errorText", cause); checkStringContains(e.toString(), "[UNAUTHENTICATED,Unauthenticated OAuth fetch]"); assertEquals(cause, e.getCause()); }