@Test(expected = PagSeguroLibException.class) public void shouldThrowsErrorLib() throws Exception { when(httpClient.execute(any(HttpMethod.class), anyString(), anyMap(), any(HttpRequestBody.class))).thenThrow(new IOException()); authorizationSearchByDateRange.execute(pagSeguro, httpClient); }
@Override public DataList<? extends AuthorizationSummary> execute(PagSeguro pagseguro, HttpClient httpClient) { LOGGER.info("Iniciando busca de autorizacao por intervalo de data"); LOGGER.info("Convertendo valores"); final RequestMap map = AUTHORIZATION_SEARCH_MP.convert(authorizationSearch); LOGGER.info("Valores convertidos"); final HttpResponse response; try { LOGGER.debug(String.format("Parametros: %s", map)); response = httpClient.execute(HttpMethod.GET, String.format(Endpoints.AUTHORIZATION_SEARCH, pagseguro.getHost(), map.toUrlEncode(CharSet.ENCODING_UTF)), null, null); LOGGER.debug(String.format("Resposta: %s", response.toString())); } catch (IOException e) { LOGGER.error("Erro ao executar busca de autorizacao por intervalo de data"); throw new PagSeguroLibException(e); } LOGGER.info("Parseando XML de resposta"); DataList<? extends AuthorizationSummary> authorizationsSummary = response.parseXMLContent(pagseguro, AuthorizationSearchResponseXML.class); LOGGER.info("Parseamento finalizado"); LOGGER.info("Busca de autorizacao por intervalo de data finalizada"); return authorizationsSummary; }
AuthorizationSearchByDateRange implements PagSeguroCommand<DataList<? extends
    AuthorizationSummary>> { @Override public DataList<? extends AuthorizationSummary> execute(PagSeguro pagseguro, HttpClient httpClient) { LOGGER.info("Iniciando busca de autorizacao por intervalo de data"); LOGGER.info("Convertendo valores"); final RequestMap map = AUTHORIZATION_SEARCH_MP.convert(authorizationSearch); LOGGER.info("Valores convertidos"); final HttpResponse response; try { LOGGER.debug(String.format("Parametros: %s", map)); response = httpClient.execute(HttpMethod.GET, String.format(Endpoints.AUTHORIZATION_SEARCH, pagseguro.getHost(), map.toUrlEncode(CharSet.ENCODING_UTF)), null, null); LOGGER.debug(String.format("Resposta: %s", response.toString())); } catch (IOException e) { LOGGER.error("Erro ao executar busca de autorizacao por intervalo de data"); throw new PagSeguroLibException(e); } LOGGER.info("Parseando XML de resposta"); DataList<? extends AuthorizationSummary> authorizationsSummary = response.parseXMLContent(pagseguro, AuthorizationSearchResponseXML.class); LOGGER.info("Parseamento finalizado"); LOGGER.info("Busca de autorizacao por intervalo de data finalizada"); return authorizationsSummary; } }
AuthorizationSearchByDateRange implements PagSeguroCommand<DataList<? extends
    AuthorizationSummary>> { @Override public DataList<? extends AuthorizationSummary> execute(PagSeguro pagseguro, HttpClient httpClient) { LOGGER.info("Iniciando busca de autorizacao por intervalo de data"); LOGGER.info("Convertendo valores"); final RequestMap map = AUTHORIZATION_SEARCH_MP.convert(authorizationSearch); LOGGER.info("Valores convertidos"); final HttpResponse response; try { LOGGER.debug(String.format("Parametros: %s", map)); response = httpClient.execute(HttpMethod.GET, String.format(Endpoints.AUTHORIZATION_SEARCH, pagseguro.getHost(), map.toUrlEncode(CharSet.ENCODING_UTF)), null, null); LOGGER.debug(String.format("Resposta: %s", response.toString())); } catch (IOException e) { LOGGER.error("Erro ao executar busca de autorizacao por intervalo de data"); throw new PagSeguroLibException(e); } LOGGER.info("Parseando XML de resposta"); DataList<? extends AuthorizationSummary> authorizationsSummary = response.parseXMLContent(pagseguro, AuthorizationSearchResponseXML.class); LOGGER.info("Parseamento finalizado"); LOGGER.info("Busca de autorizacao por intervalo de data finalizada"); return authorizationsSummary; } AuthorizationSearchByDateRange(AuthorizationSearch authorizationSearch); }
AuthorizationSearchByDateRange implements PagSeguroCommand<DataList<? extends
    AuthorizationSummary>> { @Override public DataList<? extends AuthorizationSummary> execute(PagSeguro pagseguro, HttpClient httpClient) { LOGGER.info("Iniciando busca de autorizacao por intervalo de data"); LOGGER.info("Convertendo valores"); final RequestMap map = AUTHORIZATION_SEARCH_MP.convert(authorizationSearch); LOGGER.info("Valores convertidos"); final HttpResponse response; try { LOGGER.debug(String.format("Parametros: %s", map)); response = httpClient.execute(HttpMethod.GET, String.format(Endpoints.AUTHORIZATION_SEARCH, pagseguro.getHost(), map.toUrlEncode(CharSet.ENCODING_UTF)), null, null); LOGGER.debug(String.format("Resposta: %s", response.toString())); } catch (IOException e) { LOGGER.error("Erro ao executar busca de autorizacao por intervalo de data"); throw new PagSeguroLibException(e); } LOGGER.info("Parseando XML de resposta"); DataList<? extends AuthorizationSummary> authorizationsSummary = response.parseXMLContent(pagseguro, AuthorizationSearchResponseXML.class); LOGGER.info("Parseamento finalizado"); LOGGER.info("Busca de autorizacao por intervalo de data finalizada"); return authorizationsSummary; } AuthorizationSearchByDateRange(AuthorizationSearch authorizationSearch); @Override DataList<? extends AuthorizationSummary> execute(PagSeguro pagseguro,
                                                          HttpClient httpClient); }
AuthorizationSearchByDateRange implements PagSeguroCommand<DataList<? extends
    AuthorizationSummary>> { @Override public DataList<? extends AuthorizationSummary> execute(PagSeguro pagseguro, HttpClient httpClient) { LOGGER.info("Iniciando busca de autorizacao por intervalo de data"); LOGGER.info("Convertendo valores"); final RequestMap map = AUTHORIZATION_SEARCH_MP.convert(authorizationSearch); LOGGER.info("Valores convertidos"); final HttpResponse response; try { LOGGER.debug(String.format("Parametros: %s", map)); response = httpClient.execute(HttpMethod.GET, String.format(Endpoints.AUTHORIZATION_SEARCH, pagseguro.getHost(), map.toUrlEncode(CharSet.ENCODING_UTF)), null, null); LOGGER.debug(String.format("Resposta: %s", response.toString())); } catch (IOException e) { LOGGER.error("Erro ao executar busca de autorizacao por intervalo de data"); throw new PagSeguroLibException(e); } LOGGER.info("Parseando XML de resposta"); DataList<? extends AuthorizationSummary> authorizationsSummary = response.parseXMLContent(pagseguro, AuthorizationSearchResponseXML.class); LOGGER.info("Parseamento finalizado"); LOGGER.info("Busca de autorizacao por intervalo de data finalizada"); return authorizationsSummary; } AuthorizationSearchByDateRange(AuthorizationSearch authorizationSearch); @Override DataList<? extends AuthorizationSummary> execute(PagSeguro pagseguro,
                                                          HttpClient httpClient);  }