### Question:
OAuthResponseParams { public boolean sawErrorResponse() { for (Pair<HttpRequest, HttpResponse> event : requestTrace) { if (event.two == null || event.two.isError()) { return true; } } return false; } OAuthResponseParams(SecurityToken securityToken, HttpRequest originalRequest,
      BlobCrypter stateCrypter); void logDetailedWarning(String note); void logDetailedWarning(String note, Throwable e); void logDetailedInfo(String note, Throwable e); void addRequestTrace(HttpRequest request, HttpResponse response); boolean sawErrorResponse(); void addToResponse(HttpResponseBuilder response, OAuthRequestException e); OAuthClientState getNewClientState(); String getAznUrl(); void setAznUrl(String aznUrl); boolean sendTraceToClient(); void setSendTraceToClient(boolean sendTraceToClient); static final String CLIENT_STATE; static final String APPROVAL_URL; static final String ERROR_CODE; static final String ERROR_TEXT; }### Answer:
@Test public void testSawErrorResponse() { HttpRequest req = new HttpRequest(Uri.parse("http: HttpResponse ok = new HttpResponseBuilder().setHttpStatusCode(200).create(); HttpResponse redir = new HttpResponseBuilder().setHttpStatusCode(302).create(); HttpResponse notFound = new HttpResponseBuilder().setHttpStatusCode(404).create(); HttpResponse doh = new HttpResponseBuilder().setHttpStatusCode(502).create(); OAuthResponseParams params = new OAuthResponseParams(token, origRequest, crypter); assertFalse(params.sawErrorResponse()); params.addRequestTrace(req, ok); assertFalse(params.sawErrorResponse()); params.addRequestTrace(req, redir); assertFalse(params.sawErrorResponse()); params.addRequestTrace(req, null); assertTrue(params.sawErrorResponse()); params = new OAuthResponseParams(token, origRequest, crypter); params.addRequestTrace(req, notFound); assertTrue(params.sawErrorResponse()); params = new OAuthResponseParams(token, origRequest, crypter); params.addRequestTrace(req, doh); assertTrue(params.sawErrorResponse()); params.addRequestTrace(req, ok); assertTrue(params.sawErrorResponse()); }