@Test public void testDownloadReportWithBadEndpoint_fails() throws Throwable { int port = TestPortFinder.getInstance().checkOutUnusedPort(); try { AdWordsSession sessionWithBadEndpoint = new AdWordsSession.Builder() .withUserAgent("TEST_APP") .withOAuth2Credential(credential) .withEndpoint("https: .withDeveloperToken("TEST_DEVELOPER_TOKEN") .withClientCustomerId("TEST_CLIENT_CUSTOMER_ID") .build(); helper = new GenericAdWordsServices() .getBootstrapper() .getInstanceOf(sessionWithBadEndpoint, AdHocReportDownloadHelper.class); when(reportRequest.getRequestType()).thenReturn(RequestType.AWQL); String awqlString = "SELECT BadField1 FROM NOT_A_REPORT DURING NOT_A_TIME_PERIOD"; when(reportRequest.getReportRequestString()).thenReturn(awqlString); thrown.expect(ReportException.class); thrown.expectCause(Matchers.<Exception>instanceOf(ConnectException.class)); downloadReport(); } finally { TestPortFinder.getInstance().releaseUnusedPort(port); } }
@Override public ReportDownloadResponse downloadReport( ReportRequest reportRequest, Builder exceptionBuilder) throws ReportException, ReportDownloadResponseException { return impl.downloadReport(reportRequest, exceptionBuilder); }
AdHocReportDownloadHelper implements AdHocReportDownloadHelperInterface { @Override public ReportDownloadResponse downloadReport( ReportRequest reportRequest, Builder exceptionBuilder) throws ReportException, ReportDownloadResponseException { return impl.downloadReport(reportRequest, exceptionBuilder); } }
AdHocReportDownloadHelper implements AdHocReportDownloadHelperInterface { @Override public ReportDownloadResponse downloadReport( ReportRequest reportRequest, Builder exceptionBuilder) throws ReportException, ReportDownloadResponseException { return impl.downloadReport(reportRequest, exceptionBuilder); } @Inject  AdHocReportDownloadHelper(
      AdHocReportDownloadHelperImpl helperImpl, AdsUtilityRegistry adsUtilityRegistry); }
AdHocReportDownloadHelper implements AdHocReportDownloadHelperInterface { @Override public ReportDownloadResponse downloadReport( ReportRequest reportRequest, Builder exceptionBuilder) throws ReportException, ReportDownloadResponseException { return impl.downloadReport(reportRequest, exceptionBuilder); } @Inject  AdHocReportDownloadHelper(
      AdHocReportDownloadHelperImpl helperImpl, AdsUtilityRegistry adsUtilityRegistry); @Override ReportDownloadResponse downloadReport(
      ReportRequest reportRequest, Builder exceptionBuilder); @Override RawReportDownloadResponse downloadReport(ReportRequest reportRequest); @Override ReportDownloadResponse handleResponse(
      RawReportDownloadResponse rawResponse, Builder exceptionBuilder); @Override int getReportDownloadTimeout(); @Override void setReportDownloadTimeout(int reportDownloadTimeout); }
AdHocReportDownloadHelper implements AdHocReportDownloadHelperInterface { @Override public ReportDownloadResponse downloadReport( ReportRequest reportRequest, Builder exceptionBuilder) throws ReportException, ReportDownloadResponseException { return impl.downloadReport(reportRequest, exceptionBuilder); } @Inject  AdHocReportDownloadHelper(
      AdHocReportDownloadHelperImpl helperImpl, AdsUtilityRegistry adsUtilityRegistry); @Override ReportDownloadResponse downloadReport(
      ReportRequest reportRequest, Builder exceptionBuilder); @Override RawReportDownloadResponse downloadReport(ReportRequest reportRequest); @Override ReportDownloadResponse handleResponse(
      RawReportDownloadResponse rawResponse, Builder exceptionBuilder); @Override int getReportDownloadTimeout(); @Override void setReportDownloadTimeout(int reportDownloadTimeout);  }