@Test public void testFailure_failedStatusCode() throws Exception { InputStream stream = new ByteArrayInputStream(ERROR_TEXT.getBytes(AdHocReportDownloadHelper.REPORT_CHARSET)); int statusCode = 400; RawReportDownloadResponse rawResponse = new RawReportDownloadResponse(statusCode, stream, AdHocReportDownloadHelper.REPORT_CHARSET, DownloadFormat.XML.name()); try { downloadReport(DownloadFormat.XML, rawResponse, ERROR_TEXT); fail("Should have thrown an exception"); } catch (DetailedReportDownloadResponseException e) { assertEquals(statusCode, e.getHttpStatus()); assertEquals(ERROR_TEXT, e.getErrorText()); assertThat(e.toString(), org.hamcrest.Matchers.containsString(String.valueOf(statusCode))); assertThat(e.toString(), org.hamcrest.Matchers.containsString(ERROR_TEXT)); } }
@Override public ReportDownloadResponse downloadReport(ReportDefinition reportDefinition) throws ReportException, ReportDownloadResponseException { return adHocReportDownloadHelper.downloadReport( new XmlReportDefinitionRequest(reportDefinition), new DetailedReportDownloadResponseException.Builder()); }
ReportDownloader implements ReportDownloaderInterface { @Override public ReportDownloadResponse downloadReport(ReportDefinition reportDefinition) throws ReportException, ReportDownloadResponseException { return adHocReportDownloadHelper.downloadReport( new XmlReportDefinitionRequest(reportDefinition), new DetailedReportDownloadResponseException.Builder()); } }
ReportDownloader implements ReportDownloaderInterface { @Override public ReportDownloadResponse downloadReport(ReportDefinition reportDefinition) throws ReportException, ReportDownloadResponseException { return adHocReportDownloadHelper.downloadReport( new XmlReportDefinitionRequest(reportDefinition), new DetailedReportDownloadResponseException.Builder()); } ReportDownloader(AdWordsSession session); @Inject  ReportDownloader(AdHocReportDownloadHelper adHocReportDownloadHelper); }
ReportDownloader implements ReportDownloaderInterface { @Override public ReportDownloadResponse downloadReport(ReportDefinition reportDefinition) throws ReportException, ReportDownloadResponseException { return adHocReportDownloadHelper.downloadReport( new XmlReportDefinitionRequest(reportDefinition), new DetailedReportDownloadResponseException.Builder()); } ReportDownloader(AdWordsSession session); @Inject  ReportDownloader(AdHocReportDownloadHelper adHocReportDownloadHelper); @Override ReportDownloadResponse downloadReport(ReportDefinition reportDefinition); @Override ReportDownloadResponse downloadReport(String reportQuery, DownloadFormat format); @Override int getReportDownloadTimeout(); @Override void setReportDownloadTimeout(int reportDownloadTimeout); }
ReportDownloader implements ReportDownloaderInterface { @Override public ReportDownloadResponse downloadReport(ReportDefinition reportDefinition) throws ReportException, ReportDownloadResponseException { return adHocReportDownloadHelper.downloadReport( new XmlReportDefinitionRequest(reportDefinition), new DetailedReportDownloadResponseException.Builder()); } ReportDownloader(AdWordsSession session); @Inject  ReportDownloader(AdHocReportDownloadHelper adHocReportDownloadHelper); @Override ReportDownloadResponse downloadReport(ReportDefinition reportDefinition); @Override ReportDownloadResponse downloadReport(String reportQuery, DownloadFormat format); @Override int getReportDownloadTimeout(); @Override void setReportDownloadTimeout(int reportDownloadTimeout);  }